Home Database Mysql Tutorial CentOS 6.6下安装MySQL 5.6.24

CentOS 6.6下安装MySQL 5.6.24

Jun 07, 2016 pm 03:21 PM

CentOS 6.6下安装MySQL 5.6.24 1、先查看本机上已经安装的MySQL rpm ndash;qa | grep -i mysql 如果存在信息说明已经安装MySQL

CentOS 6.6下安装MySQL 5.6.24

1、先查看本机上已经安装的MySQL

rpm –qa | grep -i mysql

如果存在信息说明已经安装MySQL

需要完全卸载以前的MySQL

yum remove mysql mysql-server mysql-libs compat-mysql51

rm -rf /var/lib/mysql

rm /etc/my.cnf

查看是否还有mysql软件:

rpm -qa|grep mysql

如果存在的话,继续删除即可

2、rpm方式安装的mysql

查看系统中是否以rpm包安装的mysql:

[root@develop ~]# rpm -qa | grep -i mysql

MySQL-server-5.6.24-1.rhel5.x86_64

[root@develop ~]#

b)卸载mysql

[root@localhost local]# rpm -e MySQL-server-5.6.24-1.rhel5.x86_64

c)删除mysql服务

[root@localhost local]# chkconfig --list | grep -i mysql

[root@develop ~]# chkconfig --list | grep -i mysql

mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

[root@localhost local]# chkconfig --del mysql

d)删除分散mysql文件夹

[root@localhost local]# whereis mysql 或者 find / -name mysql

mysql: /usr/lib/mysql /usr/share/mysql

清空相关mysql的所有目录以及文件

rm -rf /usr/lib/mysql

rm -rf /usr/share/mysql

rm -rf /usr/my.cnf

通过以上几步,mysql应该已经完全卸载干净了

使用wget 直接在CentOS上下载MySQL(server、client)

若提示wget:command not found,则需先安装wget。

yum install wget –y

下载

wget 

wget 

安装时若提Failed depaendencies:/usr/bin/perl is needed by MySQL-.......,则需安装perl

yum install perl -y

安装:

安装服务

rpm -ivh  MySQL-server-5.6.24-1.rhel5.x86_64.rpm

安装客户端

rpm -ivh  MySQL-client-5.6.24-1.rhel5.x86_64.rpm

conflicts with file from package mysql-libs-5.1.....

包冲突,需将老版本的包卸载(删除)。

rpm -e  mysql-libs  --nodeps

继续安装。。。

安装完毕,启动数据库

service mysql start

输入:mysqld

提示:

image

这个是MySQL的权限问题。

永远不要使用root帐号启动MySQL Server。这样做很微笑,因为拥有FILE'权限的用户会使得MySQL Server使用root帐户创建文件(比如,~root/.bashrc),

为了防止类似的事情发生,mysqld默认拒绝用户使用root帐户启动,但root用户可以通过在命令后面加上"--user=root"选项来强行启动mysqld。

查看初始密码

cat /root/.mysql_secret

设置密码

mysql -uroot -p

粘贴查看到的初始密码

set password for 'root'@'localhost'=password('newpass');

设置mysql为开机自动启动

首先查看mysql是否是开机自动启动

-------------------------------------------------------

[root@localhost test]# chkconfig --list | grep mysql

mysqld          0:off 1:off 2:off 3:off 4:off 5:off 6:off

---------------------------------------------------------

我们发现mysqld服务并没有开机自动启动,我们当然可以通过 chkconfig mysqld on 命令来将其设置成开机启动,这样就不用每次都去手动启动了

设置初始化密码

mysqladmin -u root password '123456'

test->show databases;

关闭mysql数据库

service mysql stop

3、卸载mysql数据库

rpm -e MySQL-server

rpm -e MySQL-client

CentOS下mysql默认安装位置
如果采用RPM包安装,,安装路径应在/usr/share/mysql目录下
mysqldump文件位置:/usr/bin/mysqldump
mysqli配置文件:
/etc/my.cnf或/usr/share/mysql/my.cnf
mysql数据目录在/var/lib/mysql目录下
如果采用源代码安装,一般默认安装在/usr/local/mysql目录下

--------------------------------------分割线 --------------------------------------

如有兴趣,也可以看看这篇文章:

Linux下MySQL 5.6.23安装 

以下是小编为您精心挑选的MySQL相关内容,看看是否有所帮助:

CentOS 7下源码安装MySQL 5.6 

MySQL5.7.3.0安装配置图解教程

Ubuntu 14.04下安装MySQL

《MySQL权威指南(原书第2版)》清晰中文扫描版 PDF

Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

Ubuntu 14.04下搭建MySQL主从服务器

Ubuntu 12.04 LTS 构建高可用分布式 MySQL 集群

Ubuntu 12.04下源代码安装MySQL5.6以及Python-MySQLdb

MySQL-5.5.38通用二进制安装

--------------------------------------分割线 --------------------------------------

本文永久更新链接地址

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1261
29
C# Tutorial
1234
24
When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Can mysql and mariadb coexist Can mysql and mariadb coexist Apr 08, 2025 pm 02:27 PM

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

Laravel Eloquent ORM in Bangla partial model search) Laravel Eloquent ORM in Bangla partial model search) Apr 08, 2025 pm 02:06 PM

LaravelEloquent Model Retrieval: Easily obtaining database data EloquentORM provides a concise and easy-to-understand way to operate the database. This article will introduce various Eloquent model search techniques in detail to help you obtain data from the database efficiently. 1. Get all records. Use the all() method to get all records in the database table: useApp\Models\Post;$posts=Post::all(); This will return a collection. You can access data using foreach loop or other collection methods: foreach($postsas$post){echo$post->

RDS MySQL integration with Redshift zero ETL RDS MySQL integration with Redshift zero ETL Apr 08, 2025 pm 07:06 PM

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.

The relationship between mysql user and database The relationship between mysql user and database Apr 08, 2025 pm 07:15 PM

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

MySQL: The Ease of Data Management for Beginners MySQL: The Ease of Data Management for Beginners Apr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

See all articles