In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to install mysql remotely under linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The method of remote installation of mysql under linux is as follows: first connect to the remote server locally; then download mysql; remotely, then install mysql; remotely through rpm, and finally log in to mysql, change the password and set remote authorization.
Steps:
1. Connect locally to a remote server
two。 Check whether the server has installed mysql and learn to uninstall it
3. Download mysql remotely
4. Remote installation of mysql (including server side, client side, and dependency packages)
5. Log in to mysql, change your password and set remote authorization
1. Connect locally to a remote server
I downloaded SecureCRT.
Sessions-- > right click-- > new sessions-- > SSH2-- > continue-- > HostName: remote address / Port: remote port number (generally 22) / firewell:none/username: user name-- > ok double-click the newly created Session-- > pop-up password box-- > enter password-- > ok
At this point, connect to the remote server
two。 Check whether the server has installed mysql and learn to uninstall it
A) check to see if mysql is installed as a rpm package on the system
[root@host-15ec49514ce ~] # rpm-qa | grep-I mysqlMySQL-server-5.1.49-1.glibc23 MySQL-client-5.1.49-1.glibc23
Uninstall MySQL-server-5.1.49-1.glibc23 and MySQL-client-5.1.49-1.glibc23
[root@host-15ec49514ce ~] # rpm-e MySQL-client-5.1.49-1.glibc23 [root@host-15ec49514ce ~] # rpm-e MySQL-server-5.1.49-1.glibc23
B) check the availability of mysql services
[root@host-15ec49514ce ~] # chkconfig-- list | grep-I mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:offmysql
C) Delete decentralized mysql folders
[root@host-15ec49514ce ~] # whereis mysqlmysql: / usr/lib/mysql / usr/share/mysql
Delete separately
[root@host-15ec49514ce ~] # rm-rf / usr/lib/mysql/ [root@host-15ec49514ce ~] # rm-rf / usr/share/mysql
Note: the data and / etc/my.cnf in / var/lib/mysql will not be deleted after ⚠️ is uninstalled. Delete them manually after confirming that they are not used.
Rm-rf / var/lib/mysql rm / etc/my.cnf through the above steps, mysql has been completely uninstalled clean
3. Download mysql remotely
[root@host-15ec49514ce ~] # cd / usr/local/mysql
(1)。 download
[root@host-15ec49514ce ~] # wget https://cdn.mysql.com//archives/mysql-5.5/MySQL-5.5.44-1.linux2.6.x86_64.rpm-bundle.tar
(2)。 Decompression
Tar-xvf MySQL-5.5.44-1.linux2.6.x86_64.rpm-bundle.tar
4. Remote installation of mysql (including server side, client side, and dependency 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 your password and set remote authorization
(1)。 Execute the following command to copy the configuration file for MySQL to the / etc directory.
Cp / usr/share/mysql/my-medium.cnf / etc/my.cnf
(2)。 Run the following command to initialize MySQL and set the password, respectively.
/ usr/bin/mysql_install_db # initialize MySQL
Service mysql start # launch 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-puse mysql;select 'host' from user where user='root'; update user set host ='% 'where user='root'
⚠️: ERROR 1062 (23000): Duplicate entry'%-root' for key 'PRIMARY' ignore it
Flush privileges
(3) Authorization:
GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' your password 'WITH GRANT OPTION
The problems are roughly as follows: 1. The uninstall is not complete. Solution: follow my steps above to OK
two。 The problem occurred in the step: (1) there is no mysql directory in the / usr/local directory, so you need to create a new one (# cd / usr/local # mkdir mysql)
/ usr/share/mysql may not have my-default.cnf to 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 is a permission problem, which would not have happened if you had followed my uninstall steps above)
Delete / var/lib/mysql root root these three lines of images are as follows (in fact, mysql-bin.000001~mysql-bin.000006 can be deleted, this picture is I installed mysql twice, the first installation did not delete clean left)
4. Finally installed and configured, the files in the / var/lib/mysql directory are as follows
The above is all the contents of how to install mysql remotely under linux. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.