系统环境:centos7.4 一,查看是否安装有数据库: yum list installed | grep mysqld/mariadb 二,安装centos7系统带有mysql5.6安装包的yum源RPM资源包: rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5
系统环境:centos7.4
一,查看是否安装有数据库:
yum list installed | grep mysqld/mariadb
二,安装centos7系统带有mysql5.6安装包的yum源RPM资源包:
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum clean all
yum repolist
三,安装msyql5.6:
yum -y install mysql-community-server
四,启动服务:
systemctl start mysqld
systemctl enable mysqld
五,重置密码:是具体情况而定(可以省略,无密码登陆)
#mysql_secure_installation
Set root password? [Y/n] y [设置root用户密码]
Remove anonymous users? [Y/n] y [删除匿名用户]
Disallow root login remotely? [Y/n] n [禁止root远程登录]
Remove test database and access to it? [Y/n] y [删除test数据库]
Reload privilege tables now? [Y/n] y [刷新权限]
六,查看mysql版本:
mysql -V
mysql Ver 14.14 Distrib 5.6.39, for Linux (x86_64) using EditLine wrapper
七,验证:(无密码)
mysql -uroot -p 密码
八、设置密码和远程权限
数据库密码设置:#set password for 'root'@'localhost'=password('userpasswd');
九、配置防火墙
firewall-cmd --zone=public --add-port=3306/tcp --permanent