centos 安装mysql
本文出自:https://www.cnblogs.com/2186009311CFF/p/13254463.html
1.保证没有mysql相关东西(注意删除的都是前面查出来的路径)
rpm -qa | grep mysql
rpm -e --nodeps
whereis mysql
find / -name mysql
rm -rf
2.下载相关
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
3.权限设置
chown mysql:mysql -R /var/lib/mysql
4.初始化 MySQL:
mysqld --initialize
5.启动 MySQL:
systemctl start mysqld
6.查看 MySQL 运行状态:
systemctl status mysqld
7.验证安装
mysqladmin --version
8.创建root用户密码
mysqladmin -u root password "new_password";
9.连接
mysql -u root -p
10.设置可远程访问
grant all privileges on *.* to root@"%" identified by "你的密码"; grant all privileges on *.* to root@"localhost" identified by "你的密码"; flush privileges;
参考链接:
https://www.runoob.com/mysql/mysql-install.html
https://www.cnblogs.com/ccsert/p/12296213.html
https://www.jianshu.com/p/276d59cbc529
设置远程访问:https://cloud.tencent.com/developer/article/1496725