A. Yum installation mysql5.61. Install the warehouseto install MySQL using yum, you need to use the Yum repository in MySQL to download the appropriate system repository from the official website first .http://dev.mysql.com/downloads/repo/yum/ then install this list of warehouseswget http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpmRPM-IVH mysql-community-release-el6-5.noarch.rpmor: # Yum install http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm 2. Select VersionView the version of MySQL that can be installed[email protected] ~]# Yum repolist enabled | grep "Mysql.*-community.*" If we want to choose a version, you can do the following command to see which versions[email protected] ~]# Yum repolist all | grep mysql Select version to start version 5.6, disable 5.7 version of warehouse[ email protected] ~]# yum-config-manager--enable mysql56-community [[email protected] ~]# Yum-config-manager-- Disable Mysql57-community or disable mysql5.7 directly in the Yum repository.Edit/etc/yum.repos.d/mysql-community.repo Fileenabled=0 means disableFor 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 [email protected] yum.repos.d]# vim Mysql-community.repo# # #mysql5.5 Disable all# Enable to use MySQL 5.5[mysql55-community]name=mysql 5.5 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/enabled=0gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-mysql # # #开启mysql5.6# # Enable to use MySQL 5.6[mysql56-community]name=mysql 5.6 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/enabled=1gpgcheck=0Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-mysql # # #mysql5.7 Disable[mysql57-community]name=mysql 5.7 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/enabled=0gpgcheck=1approx. gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-mysql at this point in view can install MySQL version, only left mysql5.6[email protected] yum.repos.d]# Yum repolist enabled | grep "Mysql.*-community.*"mysql-connectors-community MySQL Connectors Communitymysql-tools-community MySQL Tools Communitymysql56-community MySQL 5.6 Community Server 396 Installing mysql5.6[email protected] yum.repos.d]# Yum install mysql-community-server start the MySQL database[[Email protected] yum.repos.d]# service mysqld startMySQL Daemon failed to start.start error, MySQL Daemon process failed to start, view error log:/var/log/mysqld.log[ERROR] innodb:auto-extending data file./ibdata1 is an different size 640 pages (rounded down to MB) than Specifie D in the. CNF file:initial 768 pages, Max 0 (relevant if non-zero) pages!2017-11-20 00:00:20 5464 [ERROR] innodb:could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit Innodb_data_file_path In my.cnf back to what it is, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, and did not yet with them in any. But is careful:do not remove old data files which contain your precious data!2017-11-20 00:00:20 5464 [ERROR] Plugin ' InnoDB ' init function returned ERROR.2017-11-20 00:00:20 5464 [ERROR] Plugin ' InnoDB ' registration as a STORAGE ENGINE failed.2017-11-20 00:00:20 5464 [ERROR] unknown/unsupported storage Engine:innodb2017-11-20 00:00:20 5464 [ERROR] aborting Workaround: Yum install mysql5.6 Data Directory location:/var/lib/mysqlDelete in this directory: Ibdata1 ib_logfile1 ib_logfile0 three directories, restart MySQL success To change the MySQL root password:[email protected] mysql]# mysqladmin-u root password ' 123123 'warning:using a password on the command line interface can is insecure.mysqladmin:unable to change password; Error: ' Column count of Mysql.user is wrong. expected, found 39. Created with MySQL 50171, now running 50638. Please use the Mysql_upgrade to fix this error. 'error message: According to the prompt to execute. [email protected] mysql]# Mysql_upgradechange MySQL password again successfully[email protected] mysql]# mysqladmin-uroot password ' 123123 'warning:using a password on the command line interface can is insecure.
Yum installs mysql5.5 MySQL 5.6 mysql5.7