数据迁移
# service MysqL stop
2.根目录下创建MysqLdata文件,并且把改文件修改为MysqL所属用户
# mkdir /MysqLdata # chown -vR MysqL:MysqL /MysqLdata/ # chmod -vR 700 /MysqLdata/
3.迁移数据
# cp -av /var/lib/MysqL/* /MysqLdata
把原有MysqL 里的数据 全部迁移到 /MysqLdata里
# vim /etc/MysqL/my.cnf
#datadir = /var/lib/MysqL
datadir = /MysqLdata
注释掉datadir原有路劲,改成 /MysqLdata文件
5.修改安全 apparmor 权限
# vim /etc/apparmor.d/usr.sbin.MysqLd
#/var/lib/MysqL/r,
#/var/lib/MysqL/** rwk,
/MysqLdata/ r,
/MysqLdata/** rwk,
注释+添加
6.启动apparmor 和MysqL
# service apparmor reload # service MysqL start
7.验证MysqL 是否迁移成功
# MysqL -u root -p #登录MysqL MysqL> create database test2; #创建数据test2 MysqL> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | bshop | | MysqL | | performance_schema | | PHPmyadmin | | test2 | +--------------------+ 6 rows in set (0.00 sec) MysqL> exit; #创建成功退出 # cd /MysqLdata/ # ls bshop ibdata1 ib_logfile1 MysqL_upgrade_info PHPmyadmin debian-5.5.flag ib_logfile0 MysqL performance_schema test2
8.删除原有数据
# rm -rvf /var/lib/MysqL
安装PHPmyadmin
1.安装PHPmyadmin
# apt-get install PHPmyadmin
2.内连接
sudo ln -s /usr/share/PHPmyadmin
MysqL remote access
原文链接:https://www.f2er.com/ubuntu/351947.html