1. Check the version number first
# uname -a
2. Download and install the Yum repository for MySQL
Download the Yum repository for MySQL
http://dev.mysql.com/downloads/repo/yum/
Then install this list of warehouses
3. Search for an installable MySQL version
After executing this command, you can see the installable MySQL:
# yum repolist enabled | grep "mysql.*-community.*"
If we are going to install the latest version, we can do it directly
# sudo yum install mysql-community-server
If we are going to choose a version, we can start by following this command to see which versions are available:
# yum repolist all | grep mysql
If you want to choose a version, there are two ways, one is to use the command to
$ sudo yum-config-manager --disable mysql56-community$ sudo yum-config-manager --enable mysql57-community-dmr
This command is to enable the 5.7 version in the warehouse, disable the 5.6 version of the book Warehouse
or edit the/etc/yum.repos.d/mysql-community.repo file
Enabled=0 means disable
For example, to install the 5.7 version of MySQL, to determine 5.6 of the enabled=0,5.7 enabled=1, one guarantee only one sub-warehouse enabled
# Note: MySQL 5.7 is currently in development. For use at your own risk.# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/[mysql57-community-dmr]name=MySQL 5.7 Community Server Development Milestone Releasebaseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
And then we can install MySQL happily again.
$ sudo yum install mysql-community-server
After the installation is complete, we start MySQL
$ sudo service mysqld start
View MySQL Status
$ sudo service mysqld status
Start the MySQL service and initialize:
# /etc/init.d/mysqld startInitializing MySQL database: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password ‘new-password‘/usr/bin/mysqladmin -u root -h iZ94vana2fdZ password ‘new-password‘Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.Please report any problems at http://bugs.mysql.com/[ OK ]Starting mysqld: [ OK ]
4. Related commands
Start the MySQL service
# service mysqld start
Restart MySQL Service
# service mysqld restart
Stop MySQL Service
# service mysqld stop
centos6.5 installation mysql5.6