http://repo.mysql.com寻找需要的版本
wget -P /opt/downloads http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
rpm -ivh /opt/downloads/mysql57-community-release-el7-11.noarch.rpm
查看要安装的
yum repolist enabled | grep mysql.*
yum install mysql-community-server
已安装
yum list installed | grep mysql
mysqld位置:/usr/sbin/mysqld
运行文件位置:/usr/bin/mysql
数据文件存放路径:/var/lib/mysql
安装路径/var/lib/mysql
配置文件:/etc/my.cnf
日志文件:/var/log/var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
进程标识文件:/var/run/mysqld/mysqld.pid
修改配置
vim /etc/my.cnf
加入
validate_password = OFF
service mysqld restart
service mysqld status
cat /var/log/mysqld.log | grep "temporary password" 查看密码并复制
mysql -u root -p
输入系统密码
把临时随机密码改成正式密码
SET PASSWORD = PASSWORD('123456');
允许远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
查看防火墙状态
systemctl status firewalld.service
若要远程访问需:
关闭防火墙
systemctl stop firewalld.service
或穿透3306端口
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
systemctl enable mysqld.service
systemctl start mysqld.service
systemctl status mysqld.service