Uninstalling mysql*****************************
The first step is to see if the MySQL database is already installed on the CentOS
grep -I. mysql
Stop the MySQL service if you have previously installed MySQL
#service mysqld Stop
The second step is to uninstall the installed MySQL (uninstall mysql-server-5.1.73-7.el6.x86_64 and mysql-5.1.73-7.el6.x86_64 first)
#rpm-ev mysql-server-5.1. 7-ev mysql-5.1. 7perl-dbd-mysql-4.013-3-ev mysql-devel- 5.1. 7. el6.x86_64
Uninstall the mysql-libs-5.1.73-7.el6.x86_64 from CentOS
# Rpm-ev--nodeps mysql-libs-5.1. 7. el6.x86_64
The third step is to find the previous version of MySQL directory and delete the old version of MySQL files and libraries
#Find /-name MySQL
Delete the corresponding MySQL directory
RM -rf/var/lib/mysql/
Fourth step, see if the MySQL database is already installed on CentOS
grep MySQL
No results, instructions have been uninstalled thoroughly, next install MySQL directly
Installing mysql**************************
Yum installation
The first step is to view the downloadable version of the MySQL database available on Yum
Yum grep MySQL
Step two, start the installation
Need to mysql-server MySQL mysql-devel three components, not installed MySQL client is equivalent to install MySQL database, but also need to install Mysql-server server.
Yum Install -y mysql-server mysql Mysql-devel
Third, check the version of the mysql-server that you just installed
#rpm-qi Mysql-server
At this point, MySQL has been installed in Yum mode.
MySQL database initialization and related configuration ******************
The first step is to start MySQL
After installing the MySQL database, there will be an extra mysqld service, this is the database service, you can start the MySQL service by entering the service mysqld Start command.
Note: If you start the MySQL service for the first time, the MySQL server will first perform some initialization configuration, such as:
#service mysqld Start
When you restart the MySQL service again, you won't be prompted for so much information.
#service mysqld Restart or #service mysqld stop#service mysqld Start
Step two, check the MySQL service status
# Service MYSQLD Status
Step three, set boot start
Check to see if the MySQL service is powered up automatically
grep mysqld
The above information indicates that the MYSQLD service is not powered on, and is set to boot
# Chkconfig Mysqld on
Re-check that the MySQL service is powered up automatically
grep mysqld
Fourth, set the root account password for MySQL
MySQL database after the installation will only have a root administrator account, but at this time the root account has not set a password for it, the first time when the MySQL service, the database will do some initialization work, in the output of a large string of information, you can see such a line of information:
So we can use this command to set the password for our root account (Note: This root account is the root account of MySQL, not the root account of Linux)
Set the root account password of MySQL to 123456
' 123456 '
Fifth, log in to the MySQL database with the root user
# mysql-u Root-p
Sixth step, check if the Linux system is listening on port 3306
grep 3306
At this point, the MySQL database installation is complete
Complete!
Hadoop Learning Note -008-centos_6.5_64_yum installing MySQL