redhat7下使用yum安装mysql

时间:2020-12-03 17:19:51
通过yum安装mysql
# yum install mariadb-server -y# systemctl start mariadb.service
# systemctl enable mariadb.service
# mysql

如何设置mysql root密码

# mysql_secure_installation

 

#停止mysql并查看运行状态
systemctl stop mariadb.servicesystemctl status mariadb.service

#将默认data存储路径修改为/data0下面,使用链接的方式
mkdir /data0/mysql /data0/mariadb
mv /var/lib/mysql/* /data0/mysql
mv /var/log/mariadb/* /data0/mariadb

rm -rf /var/lib/mysql /var/log/mariadb

ln -s /data0/mysql /var/lib/mysql
ln -s /data0/mariadb /var/log/mariadb

chown -R mysql:mysql /data0/mysql/ /data0/mariadb
#根据需求进行配置
vim /etc/my.cnf