Linux-MySQL安装

配置:

1.VMware workstation pro

2.MySQL

3.centOS

5.7版本

1.配置yum仓库

#更新密钥
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

#安装
rpm --Uvh https://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm

2.安装mysql

yum -y install mysql-community-server

 3.配置自启动

systemctl start mysqld
systemctl enable mysqld

4.配置管理员用户root密码和允许远程登录的权限

获得初始密码

grep 'temporary password' /var/log/mysqld.log

 登录

mysql -uroot -p

修改密码

alter user 'root'@'localhost' identified by 'password'

 设置远程登录

grant all privileges on *.* to root@"ip地址" identified by '密码' with grant option;
flush privileges;

ip地址可以用%代替,意为可以让任何ip登录

密码表示可以给远程登录独立设置密码,和本地密码可以不同 

8.x版本

 1.配置yum仓库

#更新密钥
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

#安装
rpm --Uvh https://repo.mysql.com//mysql80-community-release-el7-7.noarch.rpm

2.安装mysql

yum -y install mysql-community-server

 3.配置自启动

systemctl start mysqld
systemctl enable mysqld

你可能感兴趣的:(linux,linux,运维,服务器)