One of MySQL's most popular relational databases, currently affiliated with Oracle, is the first choice for our daily development because of its small size, fast speed, low total cost of ownership and open source code.
- 1
To find out if MySQL was previously installed, use the following command:
Rpm-qa|grep-i MySQL
If the following package is displayed, the MySQL is installed
mysql-4.1.12-3.rhel4.1
mysqlclient10-3.23.58-4.rhel4.1
- 2
If it is already installed, you need to delete the installed database and use the following command to delete the database
Delete command: RPM-E--nodeps package Name
(Rpm-ev mysql-4.1.12-3.rhel4.1)
Delete the old version of MySQL development header files and libraries
Command: Rm-fr/usr/lib/mysql
Rm-fr/usr/include/mysql
Note: The data and/etc/my.cnf in/var/lib/mysql after uninstallation are not deleted, if determined, then manually deleted
Rm-f/etc/my.cnf
Rm-fr/var/lib/mysql
Download the RPM package for MySQL
You can download the specific address through wget because you cannot use the link please go to the official website to find
(1) Mysql-server-5.6.10-1.rhel5.x86_64.rpm:mysql server;
(2) Mysql-client-5.6.10-1.rhel5.x86_64.rpm:mysql client;
(3) Mysql-devel-5.6.10-1.rhel5.x86_64.rpm:mysql Development dependency package.
After download, put it on the Liunx server,
Installing the RPM package for MySQL server
RPM-IVH mysql-server-5.6.21-1.linux_glibc2.5.x86_64.rpm
installation process
The root user's random password will be generated when the installation is complete, and should be viewed using "Cat/root/.mysql_secret" or similar commands.
Installing the MySQL Client
RPM-IVH mysql-client-5.6.21-1.linux_glibc2.5.x86_64.rpm
Install MySQL Development dependency Package
RPM-IVH mysql-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm
Start MSYQL
After the installation is complete, MySQL is not started, and running the MySQL command will prompt the following error:
ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)
You can start MySQL using the following command:
Service MySQL Start
or use the following command:
/etc/init.d/mysql start
You can use the Set PASSWORD command to modify the root user's password, refer to the following: SET PASSWORD = PASSWORD (' root123456 ');
Log in to MySQL
Log in to MySQL server using MySQL command, when running MySQL command, you will be prompted to set the root user password
Set up boot from
/etc/init.d/mysql start
Reboot the system when Setup is complete and use the Natstat–nat command to see the MySQL port 3306
Now that we have installed the MySQL database, of course, our database does not yet support remote connection, the remote connection will appear the following code: 1130,error 1130:host 192.168.0.10 is not allowed to connect to this My SQL Server, you can use the following to resolve
Change Table method: After the computer log in MySQL, the "MySQL" Database in the "User" table in the host column, the value of "localhost" to the '% '.
Mysql>
Mysql>use MySQL;
Mysql>update user set host= '% ' where user= ' root ' and host= ' localhost ';
Remember: After changing the user table, restart the MySQL service. Restart command: Service mysql restart