mysqldump -uroot --single-transaction -R -E --databases lc2 cpm a10_goods self_warehouse > /mnt/vdc1/var/lib/mysql/datadir/lc2_cpm_a10_goods_self_warehouse.sql -p Y6B2wb
mysqld --initialize;
z mysql
cd /etc/mysql/mysql.conf.d
vim mysql.cnf
配置文件如下:
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
#datadir = /mnt/vdc1/var/lib/mysql/data # 旧数据
datadir = /mnt/vdc1/var/lib/mysql/my_data # 新数据
log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
bind-address = 0.0.0.0
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# binlog
#server_id=2
#log-bin=/var/log/mysql/mysql-bin
#expire_logs_days = 3
#binlog_format = ROW
#binlog_do_db = cpm
#binlog_do_db = lc2
# has gone away
max_allowed_packet=100M
wait_timeout=28800
chown mysql:mysql /mnt/vdc1/var/lib/mysql/my_data -R
grep -a generated /var/log/mysql/error.log
mysql -uroot -p
mysql>
alter user ‘root’@‘localhost’ identified by ‘Y6B2wb’;
flush privileges;
mysql>
create database mydatabase character set utf8mb4 collate utf8mb4_unicode_ci;
create database cpm character set utf8mb4 collate utf8mb4_unicode_ci;
create database a10_goods character set utf8mb4 collate utf8mb4_unicode_ci;
create database lc2 character set utf8mb4 collate utf8mb4_unicode_ci;
create database self_warehouse character set utf8mb4 collate utf8mb4_unicode_ci;
mysql>
grant select,insert,update,delete on self_warehouse.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on self_warehouse.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on lc2.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on lc2.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on cpm.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on cpm.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on a10_goods.* to [email protected] identified by ‘U2Fx1’;
grant select,insert,update,delete on a10_goods.* to [email protected] identified by ‘U2Fx1’;
flush privileges;
pv /mnt/vdc1/var/lib/mysql/datadir/lc2_cpm_a10_goods_self_warehouse.sql | mysql -uroot --ssl-mode=disabled -p