Go to http://dev.mysql.com/downloads/mysql/5.5.html#downloads:
Download the following three files respectively (because my machine is 32-bit, the following is a 32-bit package. If your machine is 64-bit, please download the 64-bit version ):
MySQL-server-5.5.16-1.rhel5.i386.rpm
MySQL-client-5.5.16-1.rhel4.i386.rpm
MySQL-devel-5.5.16-1.rhel4.i386.rpm
Use the wget command to download the three files through breakpoint transmission.
Http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/ wget-C
Http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/ wget-C
Http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-devel-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/ wget-C
After the download is complete, start the installation:
Rpm-IVH MySQL-server-5.5.16-1.rhel4.i386.rpm MySQL-client-5.5.16-1.rhel4.i386.rpm MySQL-devel-5.5.16-1.rhel4.i386.rpm
After the installation is complete, enter MySQL to check whether the installation is successful.
MySQL
If the following error message is displayed:
Error 2002 (hy000): Can't connect to local MySQL server through socket '/var/lib/MySQL. Sock' (2)
The MySQL service has not been started. Enter service MySQL start to start the MySQL service.
Service MySQL start
Then enter mysql. If the following message is displayed, it indicates that the operation is successful.
Welcome to the MySQL monitor. commands end with; or \ G.
Your MySQL connection ID is 1
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000,201 1, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
The default password for the first installation is null. You can use the following command to change the root password,
Mysqladmin-u Root PasswordMypassword
MypasswordThe new password you set
Then log on again
Mysql-u root-P
MySQL installed in the RPM package does not install/etc/My. CNF file, solution, just need to copy the my-huge.cnf file under the/usr/share/MySQL directory to the/etc directory, and renamed my. CNF
CP/usr/share/MySQL/my-huge.cnf/etc/My. CNF
Configure Remote Access
For security reasons, MySQL does not allow remote access by default. You can use the following to enable remote access:
// Grant data access permissions to any host
Mysql> grant all privileges on *. * To 'root' @ '%' with grant option
// Make the modification take effect
Mysql> flush privileges
If remote access is still not available, it is likely the cause of the firewall. You can enable port 3306 in the firewall or simply turn off the firewall.
The above is a summary of the first time I installed MySQL on centos. I hope it will help you.