Linux安装MySQL步骤:
1、 查看NetworkManage是否关闭:
systemctl status NetworkManage
验证jdk是否安装成功:
java -version
2、安装mysql5.7
下载yum Repository:
wget -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
安装yum Repository:
yum -y install mysql57-community-release-el7-10.noarch.rpm
安装mysql5.7:
yum -y --nogpgcheck install mysql-community-server
开机自启动:
systemctl enable mysqld.service
启动mysql:
systemctl start mysqld.service
查看状态:
systemctl status mysqld.service
获取临时密码:
grep "password" /var/log/mysqld.log
登录mysql:
mysql -uroot -p”跟上获取到的随机密码”
关闭密码复杂验证:
set global validate_password_policy=0;
set global validate_password_length=1;
设置密码:
alter user user() identified by "123456";
切换:
use mysql;
修改权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; --修改权限:
flush privileges; --刷新权限
select host,user,authentication_string from user; --查看权限
按下Ctrl加z键可以退出mysql。
卸载yum Repository:
因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉:
yum -y remove mysql57-community-release-el7-10.noarch
再次登录mysql: