Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql local data directory migration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Requirement: there is no space in the original directory of mysql. You need to migrate the mysql directory on this machine.

Mkdir-p / home/mysql3306/data

Mkdir-p / home/mysql3306/log

Mkdir-p / home/mysql3306/run/mysqld

Original directory: / var/lib/mysql

Migration destination directory: / home/mysql3306/data

Cp-r / var/lib/mysql/* / home/mysql3306/data/

Chown-R mysql.mysql / home/mysql3306

-

Vim / etc/my.cnf

# join_buffer_size = 128m

# sort_buffer_size = 2m

# read_rnd_buffer_size = 2m

# datadir=/var/lib/mysql

Datadir=/home/mysql3306/data

# socket=/var/lib/mysql/mysql.sock

Socket=/home/mysql3306/data/mysql.sock

Lower_case_table_names=1

# Disabling symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

Max_connections=1000

Max_connect_errors=300

# Recommended in standard MySQL setup

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]

# log-error=/var/log/mysqld.log

Log-error=/home/mysql3306/log/mysqld.log

# pid-file=/var/run/mysqld/mysqld.pid

Pid-file=/home/mysql3306/run/mysqld/mysqld.pid

[mysql] # # add 2 lines here to avoid not finding the sock file when you mysql-uroot-p

Socket=/home/mysql3306/data/mysql.sock

Wq: save it here

-

Vim / etc/init.d/mysqld # # modify the following variables

Get_mysql_option mysqld datadir "/ home/mysql3306/data"

# get_mysql_option mysqld datadir "/ var/lib/mysql"

Datadir= "$result"

Get_mysql_option mysqld socket "$datadir/mysql.sock"

Socketfile= "$result"

Get_mysql_option mysqld_safe log-error "/ home/mysql3306/log/mysqld.log"

# get_mysql_option mysqld_safe log-error "/ var/log/mysqld.log"

Errlogfile= "$result"

Get_mysql_option mysqld_safe pid-file "/ home/mysql3306/run/mysqld/mysqld.pid"

# get_mysql_option mysqld_safe pid-file "/ var/run/mysqld/mysqld.pid"

-

/ etc/init.d/mysqld stop

/ etc/init.d/mysqld start

Mysql-uroot-p verifies whether the data is in the

Desc table name

Error-preserving SQLSTATE [HY000]: General error: 1030 Got error 28 from storage engine

This is because the / tmp directory runs out of space, rm-rf / var/lib/mysql can free up space, and delete other files, as long as you can free up some space.

Complete

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report