centos7环境mysql-5.7.30安装使用

mysql安装

检查是否安装

rpm -qa |grep mysql

检查依赖

rpm -qa |grep mariadb

若有安装依赖则卸载安装最新依赖

rpm -e --nodeps mariadb-libs-5.5.65-1.el7.x86_64

安装依赖

yum -y install libaio perl net-tools

获取安装包

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar

解包

tar -xvf mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar

安装

rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm

启动服务

service mysqld restart

systemctl start mysqld

添加开机启动

systemctl enable mysqld

查看进程

ps -aux|grep mysql

查看监听端口

netstat -nap|grep mysql

查看临时密码

grep "password" /var/log/mysqld.log

登陆

mysql -u root -p 临时密码

修改密码

可修改密码策略强度低一点

set global validate_password_policy=LOW;

可修改密码长度为6

set global validate_password_length=6;

set password = password("你的密码");

重新进入测试

mysql -u root -p  你的密码

show databases

设置远程访问

use mysql;

update user set host='%' where user='root';

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

flush privileges;

参考

https://blog.csdn.net/u013449046/article/details/106440256

你可能感兴趣的:(centos7环境mysql-5.7.30安装使用)