I have been using Ubuntu for a long time and used to install it online. In centos, use rmp package to install it first, and record the following steps:
1. Check and uninstall MySQL installed on the local machine
Rpm-qa | grep-I mysql
Check results:
Mysql-5.1.66-2.el6_3.x86_64
Mysql-libs-5.1.66-2.el6_3.x86_64
Mysql-devel-5.1.66-2.el6_3.x86_64
It indicates that MySQL has been installed in the system and is uninstalled:
Rpm-e -- nodeps mysql-devel-5.1.66-2.el6_3.x86_64
Rpm-e -- nodeps mysql-5.1.66-2.el6_3.x86_64
Rpm-e -- nodeps mysql-libs-5.1.66-2.el6_3.x86_64
After force uninstallation, check whether there are any residual files:
Find/-name mysql
If yes:
Rm-rf/var/lib/mysql /*
2. Install MySQL
Upload and install the downloaded RPM Package. First, install the server.
Rpm-ivh MySQL-server-5.5.44-1.el6.x86_64.rpm
Then install the client:
Rpm-ivh MySQL-client-5.5.44-1.el6.x86_64.rpm
Start the MySQL service after installation.
Service mysql restart
Change the default password:
/Usr/bin/mysqladmin-u root password 'new password'
Use mysql-uroot-p to test whether MySQL can be logged on normally.
3. Configure MySQL
MySQL installed using the official RPM Package cannot find the my. cnf file. After the official installation, the configuration file directory is:
/Usr/share/mysql/my-medium.cnf.
Copy to etc and rename it:
Cp/usr/share/mysql/my-medium.cnf/etc/my. cnf
Then you can edit my. cnf.
4. Problem solving
Error description:
Starting MySQL... The server quit without updating PID file (/var/lib/mysql/myname. pid). [failed]
In this case, first try to disable the selinux service.
Vi/etc/selinux/config
Change SELINUX = enforcing to SELINUX = disabled.
Save and restart the server.