Mysql remote installation method under linux: first connect to the remote server locally; then download mysql remotely; then install mysql remotely through rpm; finally log in to mysql, change the password and set remote authorization.
4.Remotely install mysql (including server, client and dependent packages)
rpm -ivh MySQL-server-5.5.44- 1.linux2.6.x86_64.rpm
rpm -ivh MySQL-devel-5.5.44-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-client-5.5.44-1.linux2.6.x86_64.rpm
5. Log in to mysql, change the password and set remote authorization
(1). Execute the following command to copy the MySQL configuration file to the /etc directory.
cp /usr /share/mysql/my-medium.cnf /etc/my.cnf
(2). Run the following commands respectively to initialize MySQL and set the password.
/usr/bin/mysql_install_db #Initialize MySQL
service mysql start #Start MySQL
⚠️: This place will report an error:
Staring MySQL. ERROR! The server quit without updating PID file(/var/lib/mysql/host-15ec49514ce.novalocal.pid).
Solution:
[root@host-15ec49514ce ~]# find / -name mysql-bin.index /var/lib/mysql/mysql-bin.index[root@host-15ec49514ce ~]# rm /var/lib/mysql/mysql-bin.indexmysql -u root -p
use mysql;select 'host' from user where user='root& #39;; update user set host = '%' where user = 'root';
⚠️: ERROR 1062 (23000 ): Duplicate entry '%-root' for key 'PRIMARY' Leave it alone
flush privileges;
(3) authorization :
GRANT ALL PRIVILEGES ON *.* TO 'root'@' %' IDENTIFIED BY 'your password' WITH GRANT OPTION;
There are roughly the following types of problems: 1. Uninstallation is not complete. Solution: follow my above steps to OK
2. Problems in the steps: (1) There is no mysql directory in the /usr/local directory, and it needs to be created ( #cd /usr/local #mkdir mysql )
/usr/share/mysql may not have my-default.cnf, you can use my-medium.cnf directly
#cp /usr/share/mysql/my-medium.cnf /etc/my.cn
(2) service mysql start error
#rm /var/lib/mysql/mysql-bin.index
3.show databases; only information_schema and test
Solution: (The reason for this situation is the permission problem, if you follow my uninstallation steps above, it is impossible to have this situation)
p>
Delete /var/lib/mysql root root The three lines of pictures are as follows (in fact, mysql-bin.000001~mysql-bin.000006 can be deleted. The one that was installed last time was not deleted and remained clean) So far, all the problems I encountered have been solved. I hope it will be helpful to everyone.
The above is the detailed content of the method of remote installation of mysql under linux. For more information, please pay attention to other related articles on 1024programmer.com!