In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to migrate the mysql storage location to a new disk, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!
1. Prepare a new disk and format it into the same file system as the current root partition, create a directory and mount the disk
] # fdisk-l # View disk information] # fdisk / dev/sdb # partition] # df-T # File system type that can view the root partition] # mkfs.xfs / dev/sdb1 # format the new disk partition] # mkdir / data] # mount / dev/sdb1 / data # Mount the disk or write to the / etc/fatab file, add a line: / dev/sdb1 / data xfs defaults 00 boot auto mount] # df-h / confirm the mount result
two。 Stop database service and modify configuration file
] # systemctl stop mysqld] # vim / etc/my.cnf datadir=/data/mysql socket=/data/mysql/mysql.sock log-error=/data/log/mysqld.log log_bin=/data/mysql/bin-log log-bin-index=/data/mysql/bin-log.index [client] socket=/data/mysql/mysql.sock # mysql client sock defaults to read / var/lib/mysql/mysql.sock, so you need to add the client's sock configuration in the configuration file. ] # vim / data/mysql/bin-log.index
Modify the binlog index file and re-specify the storage path of the binlog.
3. Create the appropriate directory and change permissions. Migrate the database directory.
] # chown-R mysql:mysql / data] # mkdir / data/log] # mv / usr/lib/mysql / data/
4. Start the service to view the results of the changes.
] # systemctl start mysqld enter the database mysql > show variables like 'datadir';# to see the storage location of the database and check whether the data is correct. Mysql > show variables like'% sock%';# to check the location of the sock file, you can also check whether the data in the corresponding directory in / data/ is correct.
The firewall is off and selinux is in the Disabled state.
These are all the contents of the article "how to migrate mysql storage locations to a new disk". 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.