安装完mysql后
复制mysql数据库到当前路径并且重命名为mysql2
cp -r /usr/local/mysql /usr/local/mysql2
切换路径到mysql2
cd /usr/local/mysql2
复制my.cnf文件到mysql2下
cp /etc/my.cnf /usr/local/mysql2
编辑mysql2的my.cnf
vim /usr/local/mysql2/my.cnf
更改内容:
[mysqld]
port = 3307
socket = /tmp/mysql2.sock
datadir =/data/mysql2
初始化数据库mysql2
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql2
为mysql2创建启动脚本
cp /etc/init.d/mysqld /etc/init.d/mysql2
vim /etc/init.d/mysql2
更改内容:
basedir=/usr/local/mysql2
datadir=/data/mysql2
conf=$basedir/my.cnf
启动数据库mysql2
/etc/init.d/mysql2 start
复制mysql数据库到当前路径并且重命名为mysql2
cp -r /usr/local/mysql /usr/local/mysql2
切换路径到mysql2
cd /usr/local/mysql2
复制my.cnf文件到mysql2下
cp /etc/my.cnf /usr/local/mysql2
编辑mysql2的my.cnf
vim /usr/local/mysql2/my.cnf
更改内容:
[mysqld]
port = 3307
socket = /tmp/mysql2.sock
datadir =/data/mysql2
初始化数据库mysql2
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql2
为mysql2创建启动脚本
cp /etc/init.d/mysqld /etc/init.d/mysql2
vim /etc/init.d/mysql2
更改内容:
basedir=/usr/local/mysql2
datadir=/data/mysql2
conf=$basedir/my.cnf
启动数据库mysql2
/etc/init.d/mysql2 start
编辑回复