In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to change the default installation path of mysql, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
The way to modify the default installation path of mysql is to first use the command [service mysqld stop] to stop mysql and view the default path of the mysql database, then modify the MySQL configuration file and modify the MySQL startup script.
How to modify the default installation path of mysql:
1 、
Use the command: service mysqld stop stop mysql to view the mysql database default path: / var/lib/mysql establish target storage directory: mkdir / home/data use the command to copy the file: cp-R / var/lib/mysql / home/data/mysql
2 、
Modify the MySQL configuration file: / etc/my.cnf use VIM to edit: vim / etc/my.cnf change the datadir to the new path datadir=/home/data/mysql to ensure that the MySQL can be normal, you can not modify the location of the mysql.sock file, or indicate the location of the new mysql.sock file. Socket = / var/lib/mysql/mysql.sock (original content, you can comment this line with "#", or this line can not be changed) socket = / home/data/mysql/mysql.sock (plus this line)
3 、
Modify the MySQL startup script / etc/init.d/mysqld to find the contents in the getmysqloption mysqld datadir "/ var/lib/mysql/mysql" double quotes and change them to the actual storage path / home/data/mysql
4 、
If you change the location where the mysql.sock is generated in the MySQL configuration file / etc/my.cnf, you need to make a link to the new file location.
The command above ln-sv / home/data/mysql/mysql.sock / var/lib/mysql/mysql.sock establishes a soft link for mysql.sock, otherwise the file / var/lib/mysql/mysql.sock will not be found when logging in using the mysql client
5 、
Restart mysqld service mysqld restart
Thank you for reading this article carefully. I hope the editor will share how to change the default installation path of mysql to help everyone. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
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.