Install MySQL 5.6.21 in CentOS 6.5
Install MySQL
MySQL is the most widely used database in Linux. The version installed using the online yum method lags behind several minor versions on the MySQL website. This section tests and installs the new version of MySQL.
Test the machine environment:
VMware Workstation 10 Virtual Machine
Memory: 1 GB
Linux: CentOS MinimalCD 6.5
JAVA: JAVA_HOME =/opt/jdk
Before installing mysql, You need to query the mysql-related software contained in the system.
Rpm-qa | grep-I mysql // grep-I is a case-insensitive query that only displays
Screen Display:
Mysql-libs-5.1.71-1.el6.i686 // It is dependent on several software, where in the mini version postfix software depends on mysql-libs, a lot of recommendations on the network are directly deleted, yum remove mysql-libs or rpm-e -- nodeps mysql-libs-5.1.71-1.el6.i686, always think this is not good.
Find the mysql official information, get the installation method is to use MySQL-shared-compat to replace the mysql-libs-5.1.71-1.el6.i686 with the same version after installing mysql.
Download mysql address: http://dev.mysql.com/downloads/mysql/
CentOS is a RedHatLinux series. Therefore, if you select RedHatLinux (see the red line), the web page will automatically become a RedHatLinux-related mysql download:
Download 2 content, one is mysql-5.6.21-1.el6.i686.rpm-bundle.tar, This is a collection of several programs, the other is the MySQL-shared-compat-5.6.21-1.el6.i686.rpm, This is the package includes MySQL 3.23 and MySQL 4.0 shared library. If you have installed an application to dynamically connect to MySQL 3.23, but you want to upgrade to ySQL 4.0 without breaking the database subordination, install the software package instead of installing MySQL-shared. This installation package is included from MySQL 4.0.13.
Upload two files to centos to decompress mysql-5.6.21-1.el6.i686.rpm-bundle.tar.
#tar xvf MySQL-5.6.21-1.el6.i686.rpm-bundle.tar MySQL-client-5.6.21-1.el6.i686.rpmMySQL-devel-5.6.21-1.el6.i686.rpmMySQL-shared-5.6.21-1.el6.i686.rpmMySQL-test-5.6.21-1.el6.i686.rpmMySQL-server-5.6.21-1.el6.i686.rpmMySQL-embedded-5.6.21-1.el6.i686.rpm#ls -ltotal 415068-rw-r--r--. 1 root root 210442240 Nov 11 11:12 MySQL-5.6.21-1.el6.i686.rpm-bundle.tar-rw-r--r--. 1 7155 wheel 17813608 Sep 12 16:25 MySQL-client-5.6.21-1.el6.i686.rpm-rw-r--r--. 1 7155 wheel 3131328 Sep 12 16:25 MySQL-devel-5.6.21-1.el6.i686.rpm-rw-r--r--. 1 7155 wheel 83106000 Sep 12 16:25 MySQL-embedded-5.6.21-1.el6.i686.rpm-rw-r--r--. 1 7155 wheel 54611632 Sep 12 16:26 MySQL-server-5.6.21-1.el6.i686.rpm-rw-r--r--. 1 7155 wheel 1878756 Sep 12 16:27 MySQL-shared-5.6.21-1.el6.i686.rpm-rw-r--r--. 1 root root 4141488 Nov 18 14:42 MySQL-shared-compat-5.6.21-1.el6.i686.rpm-rw-r--r--. 1 7155 wheel 49887932 Sep 12 16:27 MySQL-test-5.6.21-1.el6.i686.rpm
Install MySQL-shared-compat to replace mysql-libs. If you do not replace mysql-libs, you will be prompted that the postfix depends on mysql-libs:
# rpm -i MySQL-shared-compat-5.6.21-1.el6.i686.rpm# rpm -qa | grep -i mysqlmysql-libs-5.1.71-1.el6.i686MySQL-shared-compat-5.6.21-1.el6.i686# yum remove mysql-libs
To test the installation of MySQL-server, the following prompt is displayed:
# rpm -ivh --test MySQL-server-5.6.21-1.el6.i686.rpm# yum install perl
Install MySQL-server and MySQL-client:
# rpm -ivh MySQL-server-5.6.21-1.el6.i686.rpmPreparing... ########################################### [100%] 1:MySQL-server ########################################### [100%]………………………………A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !You will find that password in '/root/.mysql_secret'.You must change that password on your first connect,no other statement but 'SET PASSWORD' will be accepted.See the manual for the semantics of the 'password expired' flag.Also, the account for the anonymous user has been removed.In addition, you can run: /usr/bin/mysql_secure_installation………………………………# rpm -ivh MySQL-client-5.6.21-1.el6.i686.rpmPreparing... ########################################### [100%] 1:MySQL-client ########################################### [100%]
When installing MySQL-server, see the above section to ensure that the newly installed root password is at/root /. in mysql_secret, This is a random password. You need to run/usr/bin/mysql_secure_installation to delete the anonymous user. Of course, it is not recommended to run it with the root user. The rpm package has already created a mysql user. You can use this user:
# More. mysql_secret # The random password set for the root user at Tue Nov 18 22:57:46 2014 (local time): NljqL63OYlGo5cqy <-get The root password for accessing mysql: NljqL63OYlGo5cqy # service mysql startStarting MySQL... SUCCESS! #/Usr/bin/mysql_secure_installation -- user = mysqlNOTE: running all parts of this script is recommended for all MySQL servers in production use! Please read each step carefully! In order to log into MySQL to secure it, we'll need the currentpassword for the root user. if you 've just installed MySQL, andyou haven' t set the root password yet, the password will be blank, so you shoshould just press enter here. enter current password for root (enter for none): <-use the obtained root password NljqL63OYlGo5cqyOK, successfully used password, moving on... setting the root password ensures that nobody Can log into the MySQLroot user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] y <-whether to change the password of the root user, enter y and press enter. We strongly recommend that you change the New password: <-set the password of the root user Re-enter new password: <-enter your Password updated successfully again! Reloading privilege tables... Success! By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. this is intended only for testing, and to make the installationgo a bit smoother. you shoshould remove them before moving into aproduction environment. remove anonymous users? [Y/n] y <-whether to delete anonymous users. It is recommended to delete anonymous users in the production environment. Therefore, enter y and press enter... Success! Normally, root shoshould only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y <-whether to disable remote root login. Select Y/n as needed and press Enter. We recommend that you disable... Success! By default, MySQL comes with a database named 'test' that anyone canaccess. this is also intended only for testing, and shocould be removedbefore moving into a production environment. remove test database and access to it? [Y/n] y <-whether to delete the test database. Enter y and press ENTER-Dropping test database... Success! -Removing privileges on test database ...... Success! Reloading the privilege tables will ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [Y/n] y: whether to reload the permission table. Enter y and press enter... Success! All done! If you 've completed all of the above steps, your MySQLinstallation shoshould now be secure. Thanks for using MySQL! Cleaning up...
So far, MySQL has been installed, and finally check whether MySQL has been added to the boot service:
# Chkconfigauditd 0: off 1: off 2: on 3: on 4: on 5: on 6: offblk-availability 0: off 1: on 2: on 3: on 4: on 5: on 6: offcrond 0: off 1: off 2: on 3: on 4: on 5: on 6: offip6tables 0: off 1: off 2: on 3: on 4: on 5: on 6: offiptables 0: off 1: off 2: on 3: on 4: on 5: on 6: offiscsi 0: off 1: off 2: off 3: on 4: on 5: on 6: offiscsid 0: off 1: off 2: off 3: on 4: on 5: on 6: offlvm2-monitor 0: off 1: on 2: on 3: on 4: on 5: on 6: offmdmonitor 0: off 1: off 2: on 3: on 4: on 5: on 6: offmultipathd 0: off 1: off 2: off 3: off 4: off 5: off 6: offmysql 0: off 1: off 2: on 3: on 4: on 5: on 6: off <-The netconsole 0: off 1: off 2: off 3: off 4: off 5: off 6: offnetfs 0: off 1: off 2: off 3: on 4: on 5: on 6: offnetwork 0: off 1: off 2: on 3: on 4: on 5: on 6: offpostfix 0: off 1: off 2: on 3: on 4: on 5: on 6: offrdisc 0: off 1: off 2: off 3: off 4: off 5: off 6: offrestorecond 0: off 1: off 2: off 3: off 4: off 5: off 6: offrsyslog 0: off 1: off 2: on 3: on 4: on 5: on 6: offsaslauthd 0: off 1: off 2: off 3: off 4: off 5: off 6: offsshd 0: off 1: off 2: on 3: on 4: on 5: on 6: offudev-post 0: off 1: on 2: on 3: on 4: on 5: on 6: off
The directories involved after MySQL installation are as follows:
Directory |
Contents in the directory |
/Usr/bin |
Client programs and scripts |
/Usr/sbin |
Mysqld Server |
/Var/lib/mysql |
Database Log Files |
/Usr/share/info |
Information Format Manual |
/Usr/share/man |
Unix manual page |
/Usr/include/mysql |
Including (title) files |
/Usr/lib/mysql |
Mysql lib package |
/Usr/share/mysql |
Miscellaneous support files, including error messages) character setting files, sample configuration files, SQL database installation |
/Usr/share/SQL-Example |
Benchmark |
Now, you can test your MySQL.
-------------------------------------- Split line --------------------------------------
Install MySQL in Ubuntu 14.04
MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF
Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL
Build a MySQL Master/Slave server in Ubuntu 14.04
Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
MySQL-5.5.38 universal binary Installation
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: