Centos6.5 install mysql5.6 and centos6.5mysql5.6
1. Check the version number first.
# uname -a
2. Download and install Mysql's yum Repository
Download the yum repository of Mysql
Http://dev.mysql.com/downloads/repo/yum/
Then install the repository list.
$ sudo yum localinstall mysql-community-release-el6-5.noarch.rpm
3. Search for installable mysql versions
After executing this command, you can see the installed mysql:
# yum repolist enabled | grep "mysql.*-community.*"
If you want to install the latest version, you can directly execute
# sudo yum install mysql-community-server
If you want to select a version, run the following command to check which versions are available:
# yum repolist all | grep mysql
To select a version, you can use either of the following methods:
$ sudo yum-config-manager --disable mysql56-community$ sudo yum-config-manager --enable mysql57-community-dmr
This command enables version 5.7 in the repository and disables the sub-repository of version 5.6.
Or edit the/etc/yum. repos. d/mysql-community.repo File
# Enable to use MySQL 5.6[mysql56-community]name=MySQL 5.6 Community Serverbaseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/enabled=1gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Enabled = 0 indicates disabled
For example, to install mysql 5.7, make sure that the enabled of mysql 5.6 is 0 and the enabled of mysql 5.7 is 1. Ensure that only one sub-repository is enabled at a time.
# 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
Then we can install mysql happily.
$ sudo yum install mysql-community-server
After the installation is complete, start mysql
$ sudo service mysqld start
View mysql status
$ sudo service mysqld status
Start mysql 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 mysql Service
# service mysqld start
Restart mysql Service
# service mysqld restart
Stop mysql Service
# service mysqld stop