[root@dean opt]# rpm -qa | grep mysql mysql-libs-5.1.73-8.el6_8.x86_64
2. Query the downloadable version of the mysql database provided on yum
[root@dean opt]# yum list | grep mysql mysql-libs.x86_64 5.1.73-8.el6_8 @base apr-util-mysql.x86_64 1.3.9-3.el6_0.1 base asterisk-mysql.x86_64 1.8.32.3-2.el6 epel bacula-director-mysql.x86_64 5.0.0-13.el6 base bacula-storage-mysql.x86_64 5.0.0-13.el6 base collectd-mysql.x86_64 4.10.9-4.el6 epel dmlite-plugins-mysql.x86_64 0.8.6-2.el6 epel dovecot-mysql.x86_64 1:2.0.9-22.el6 base dpm-copy-server-mysql.x86_64 1.9.0-1.el6 epel dpm-name-server-mysql.x86_64 1.9.0-1.el6 epel dpm-server-mysql.x86_64 1.9.0-1.el6 epel dpm-srm-server-mysql.x86_64 1.9.0-1.el6 epel dspam-mysql.x86_64 3.10.2-7.el6 epel exim-mysql.x86_64 4.89-1.el6 epel freeradius-mysql.x86_64 2.2.6-6.el6_7 base fts-mysql.i686 3.6.8-1.el6 epel fts-mysql.x86_64 3.6.8-1.el6 epel gnokii-smsd-mysql.x86_64 0.6.30-2.el6 epel holland-mysql.noarch 1.0.14-3.el6 epel holland-mysqldump.noarch 1.0.14-3.el6 epel holland-mysqllvm.noarch 1.0.14-3.el6 epel lfc-server-mysql.x86_64 1.9.0-1.el6 epel libdbi-dbd-mysql.x86_64 0.8.3-5.1.el6 base libnss-mysql.i686 1.5-12.el6 epel libnss-mysql.x86_64 1.5-12.el6 epel libodb-mysql.i686 2.3.0-1.el6 epel libodb-mysql.x86_64 2.3.0-1.el6 epel libodb-mysql-devel.i686 2.3.0-1.el6 epel libodb-mysql-devel.x86_64 2.3.0-1.el6 epel lighttpd-mod_authn_mysql.x86_64 1.4.45-1.el6 epel lighttpd-mod_mysql_vhost.x86_64 1.4.45-1.el6 epel lua-sql-mysql.x86_64 2.1.1-7.el6 epel mod_auth_mysql.x86_64 1:3.0.0-11.el6_0.1 base mydns-mysql.x86_64 1.2.8.31-2.el6 epel mysql.x86_64 5.1.73-8.el6_8 base mysql ++. i686 3.0.9-3.el6 epel mysql ++. x86_64 3.0.9-3.el6 epel mysql ++ - devel.i686 3.0.9-3.el6 epel mysql ++ - devel.x86_64 3.0.9-3.el6 epel mysql ++ - manuals.x86_64 3.0.9-3.el6 epel mysql-bench.x86_64 5.1.73-8.el6_8 base mysql-connector-java.noarch 1:5.1.17-6.el6 base mysql-connector-odbc.x86_64 5.1.5r1144-7.el6 base mysql-connector-python.noarch 1.1.6-1.el6 epel mysql-devel.i686 5.1.73-8.el6_8 base mysql-devel.x86_64 5.1.73-8.el6_8 base mysql-embedded.i686 5.1.73-8.el6_8 base mysql-embedded.x86_64 5.1.73-8.el6_8 base mysql-embedded-devel.i686 5.1.73-8.el6_8 base mysql-embedded-devel.x86_64 5.1.73-8.el6_8 base mysql-libs.i686 5.1.73-8.el6_8 base mysql-mmm.noarch 2.2.1-2.el6 epel mysql-mmm-agent.noarch 2.2.1-2.el6 epel mysql-mmm-monitor.noarch 2.2.1-2.el6 epel mysql-mmm-tools.noarch 2.2.1-2.el6 epel mysql-proxy.i686 0.8.5-2.el6 epel mysql-proxy.x86_64 0.8.5-2.el6 epel mysql-proxy-devel.i686 0.8.5-2.el6 epel mysql-proxy-devel.x86_64 0.8.5-2.el6 epel mysql-server.x86_64 5.1.73-8.el6_8 base mysql-test.x86_64 5.1.73-8.el6_8 base mysql-utilities.noarch 1.3.6-1.el6 epel mysql_fdw_96.x86_64 2.2.0-1.rhel6 pgdg96 mysql_fdw_96-debuginfo.x86_64 2.2.0-1.rhel6 pgdg96 mysqlcompat96.noarch 0.0.7-1.rhel6 pgdg96 mysqlreport.noarch 3.5-4.el6 epel mysqltuner.noarch 1.6.0-1.el6 epel nagios-plugins-mysql.x86_64 2.1.4-3.el6 epel ndoutils-mysql.x86_64 1.5.2-1.el6 epel nodejs-mysql.noarch 2.0.0-alpha9.2.el6.2 epel opendbx-mysql.x86_64 1.4.6-6.el6 epel opensips-mysql.x86_64 1.7.2-2.el6 epel pam_mysql.i686 1: 0.7-0.12.rc1.el6 epel pam_mysql.x86_64 1: 0.7-0.12.rc1.el6 epel pcp-pmda-mysql.x86_64 3.10.9-9.el6 base pdns-backend-mysql.x86_64 3.3.3-2.el6 epel perl-Class-DBI-mysql.noarch 1.00-7.el6 epel perl-Test-mysqld.noarch 0.17-3.el6 epel php-mysql.x86_64 5.3.3-49.el6 base php-pear-MDB2-Driver-mysql.noarch 1.5.0-0.8.b4.el6 epel php-pear-MDB2-Driver-mysqli.noarch 1.5.0-0.8.b4.el6 epel poco-mysql.i686 1.4.2p1-3.el6 epel poco-mysql.x86_64 1.4.2p1-3.el6 epel proftpd-mysql.x86_64 1.3.3g-10.el6 epel qt-mysql.i686 1:4.6.2-28.el6_5 base qt-mysql.x86_64 1:4.6.2-28.el6_5 base qt5-qtbase-mysql.i686 5.6.1-3.el6 epel qt5-qtbase-mysql.x86_64 5.6.1-3.el6 epel rekall-mysql.i686 2.4.6-13.el6 epel rekall-mysql.x86_64 2.4.6-13.el6 epel root-sql-mysql.x86_64 5.34.36-1.el6 epel rsyslog-mysql.x86_64 5.8.10-10.el6_6 base rsyslog7-mysql.x86_64 7.4.10-7.el6 base ruby-mysql.x86_64 2.8.2-1.el6 epel soci-mysql.i686 3.2.2-2.el6 epel soci-mysql.x86_64 3.2.2-2.el6 epel soci-mysql-devel.i686 3.2.2-2.el6 epel soci-mysql-devel.x86_64 3.2.2-2.el6 epel tcl-mysqltcl.x86_64 3.052-1.el6 epel voms-mysql-plugin.x86_64 3.1.7-1.el6 epel zabbix-proxy-mysql.x86_64 1.8.22-1.el6 epel zabbix-server-mysql.x86_64 1.8.22-1.el6 epel zabbix-web-mysql.noarch 1.8.22-1.el6 epel zabbix20-proxy-mysql.x86_64 2.0.20-1.el6 epel zabbix20-server-mysql.x86_64 2.0.20-1.el6 epel zabbix20-web-mysql.noarch 2.0.20-1.el6 epel zabbix22-dbfiles-mysql.noarch 2.2.16-1.el6 epel zabbix22-proxy-mysql.x86_64 2.2.16-1.el6 epel zabbix22-server-mysql.x86_64 2.2.16-1.el6 epel zabbix22-web-mysql.noarch 2.2.16-1.el6 epel
3. Install the mysql server
[root@dean opt]# yum install -y mysql-server mysql mysql-devel Loaded plugins: fastestmirror, refresh-packagekit Set up the installation process Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Package mysql-server-5.1.73-8.el6_8.x86_64 is installed and the latest version Package mysql-5.1.73-8.el6_8.x86_64 is installed and is the latest version resolve dependencies --> perform transaction check ---> Package mysql-devel.x86_64 0:5.1.73-8.el6_8 will be 安装 --> handle the dependency openssl-devel, which is required by the package mysql-devel-5.1.73-8.el6_8.x86_64 --> perform transaction check ---> Package openssl-devel.x86_64 0:1.0.1e-57.el6 will be 安装 --> Process dependency zlib-devel, which is required by package openssl-devel-1.0.1e-57.el6.x86_64 --> Process dependency krb5-devel, which is required by package openssl-devel-1.0.1e-57.el6.x86_64 --> perform transaction check ---> Package krb5-devel.x86_64 0:1.10.3-65.el6 will be 安装 --> Process dependency libkadm5(x86-64) = 1.10.3-65.el6, which is required by package krb5-devel-1.10.3-65.el6.x86_64 --> handle the dependency libselinux-devel, which is required by the package krb5-devel-1.10.3-65.el6.x86_64 --> Process dependency libcom_err-devel, which is required by package krb5-devel-1.10.3-65.el6.x86_64 --> Process dependency keyutils-libs-devel, which is required by package krb5-devel-1.10.3-65.el6.x86_64 ---> Package zlib-devel.x86_64 0:1.2.3-29.el6 will be 安装 --> perform transaction check ---> Package keyutils-libs-devel.x86_64 0:1.4-5.el6 will be 安装 ---> Package libcom_err-devel.x86_64 0:1.41.12-23.el6 will be 安装 ---> Package libkadm5.x86_64 0:1.10.3-65.el6 will be 安装 ---> Package libselinux-devel.x86_64 0:2.0.94-7.el6 will be 安装 --> Process dependency libsepol-devel >= 2.0.32-1, which is required by package libselinux-devel-2.0.94-7.el6.x86_64 --> Process dependency pkgconfig(libsepol), which is required by package libselinux-devel-2.0.94-7.el6.x86_64 --> perform transaction check ---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be 安装 --> Complete dependency calculation Dependency Resolution ====================================================================================================================================================== Package Architecture Version Repository Size ====================================================================================================================================================== Installing: mysql-devel x86_64 5.1.73-8.el6_8 base 130 k Install for dependencies: keyutils-libs-devel x86_64 1.4-5.el6 base 29 k krb5-devel x86_64 1.10.3-65.el6 base 504 k libcom_err-devel x86_64 1.41.12-23.el6 base 33 k libkadm5 x86_64 1.10.3-65.el6 base 143 k libselinux-devel x86_64 2.0.94-7.el6 base 137 k libsepol-devel x86_64 2.0.41-4.el6 base 64 k openssl-devel x86_64 1.0.1e-57.el6 base 1.2 M zlib-devel x86_64 1.2.3-29.el6 base 44 k Transaction Summary ====================================================================================================================================================== Install 9 Package(s) Total downloads: 2.2 M Installed size: 5.5 M Download the package: (1/9): keyutils-libs-devel-1.4-5.el6.x86_64.rpm | 29 kB 00:00 (2/9): krb5-devel-1.10.3-65.el6.x86_64.rpm | 504 kB 00:00 (3/9): libcom_err-devel-1.41.12-23.el6.x86_64.rpm | 33 kB 00:00 (4/9): libkadm5-1.10.3-65.el6.x86_64.rpm | 143 kB 00:00 (5/9): libselinux-devel-2.0.94-7.el6.x86_64.rpm | 137 kB 00:00 (6/9): libsepol-devel-2.0.41-4.el6.x86_64.rpm | 64 kB 00:00 (7/9): mysql-devel-5.1.73-8.el6_8.x86_64.rpm | 130 kB 00:00 (8/9): openssl-devel-1.0.1e-57.el6.x86_64.rpm | 1.2 MB 00:01 (9/9): zlib-devel-1.2.3-29.el6.x86_64.rpm | 44 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------ Total 1.0 MB/s | 2.2 MB 00:02 run rpm_check_debug Execute transaction test Transaction test succeeded execute transaction Installing: zlib-devel-1.2.3-29.el6.x86_64 1/9 Installing: libcom_err-devel-1.41.12-23.el6.x86_64 2/9 Installing: libkadm5-1.10.3-65.el6.x86_64 3/9 Installing: libsepol-devel-2.0.41-4.el6.x86_64 4/9 Installing: libselinux-devel-2.0.94-7.el6.x86_64 5/9 Installing: keyutils-libs-devel-1.4-5.el6.x86_64 6/9 Installing: krb5-devel-1.10.3-65.el6.x86_64 7/9 Installing: openssl-devel-1.0.1e-57.el6.x86_64 8/9 Installing: mysql-devel-5.1.73-8.el6_8.x86_64 9/9 Verifying : keyutils-libs-devel-1.4-5.el6.x86_64 1/9 Verifying : libsepol-devel-2.0.41-4.el6.x86_64 2/9 Verifying : openssl-devel-1.0.1e-57.el6.x86_64 3/9 Verifying : krb5-devel-1.10.3-65.el6.x86_64 4/9 Verifying : libkadm5-1.10.3-65.el6.x86_64 5/9 Verifying : libcom_err-devel-1.41.12-23.el6.x86_64 6/9 Verifying : libselinux-devel-2.0.94-7.el6.x86_64 7/9 Verifying : mysql-devel-5.1.73-8.el6_8.x86_64 8/9 Verifying : zlib-devel-1.2.3-29.el6.x86_64 9/9 It has been installed: mysql-devel.x86_64 0:5.1.73-8.el6_8 Installed as a dependency: keyutils-libs-devel.x86_64 0:1.4-5.el6 krb5-devel.x86_64 0:1.10.3-65.el6 libcom_err-devel.x86_64 0:1.41.12-23.el6 libkadm5.x86_64 0:1.10.3-65.el6 libselinux-devel.x86_64 0:2.0.94-7.el6 libsepol-devel.x86_64 0:2.0.41-4.el6 openssl-devel.x86_64 0:1.0.1e-57.el6 zlib-devel.x86_64 0:1.2.3-29.el6 complete!
Fourth, start the mysql service
[root@dean opt]# service mysqld start Initializing MySQL database: Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system 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 iZbp1hqpjpxyv2tw16das2Z password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [ OK ] Starting mysqld: [ OK ]
Five, give the mysql database root account an initial password
[root@dean opt]# /usr/bin/mysqladmin -u root password '888888'
6. Log in to the mysql database
[root@dean opt]# mysql -u root -p Enter password:
Seven, view the mysql data version
[root@dean opt]# rpm -qi mysql-server Name : mysql-server Relocations: (not relocatable) Version : 5.1.73 Vendor: CentOS Release : 8.el6_8 Build Date: Fri Jan 27, 2017 06:25:43 Install Date: Thu Jun 01, 2017 20:27:02 Build Host: c1bm.rdu2.centos.org Group : Applications/Databases Source RPM: mysql-5.1.73-8.el6_8.src.rpm Size : 25884131 License: GPLv2 with exceptions Signature : RSA/SHA1, Fri Jan 27 2017 06:35:28, Key ID 0946fca2c105b9de Packager : CentOS BuildSystem <http://bugs.centos.org> URL : http://www.mysql.com Summary : The MySQL server and related files Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a client/server implementation consisting of a server daemon (mysqld) and many different client programs and libraries. This package contains the MySQL server and some accompanying files and directories.
Eight, restart the database
[root@dean opt]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
9. Check whether the data is self-starting at boot. If not, it is set to be self-starting when booting.
[root@dean opt]# chkconfig --list | grep mysqld mysqld 0:shutdown 1:shutdown 2:shutdown 3:shutdown 4:shutdown 5:shutdown 6:shutdown [root@dean opt]# chkconfig mysqld on [root@dean opt]# chkconfig --list | grep mysql mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off