MySQL单机版安装 - RPM

准备环境:

CentOS 7.5 64位

关闭防火墙

关闭selinux

帮助文档:快速安装MySQL

安装常用工具:

[root@localhost ~]# yum install -y vim tree wget

 

下载rpm:

[root@localhost ~]# wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

 

安装yum源:

[root@localhost ~]# yum install -y mysql80-community-release-el7-1.noarch.rpm

 

安装mysql:

[root@localhost ~]# yum install -y mysql-community-server

 

启动mysql:

[root@localhost ~]# systemctl start mysqld.service

 

检查mysql启动状态:

[root@localhost ~]# systemctl status mysqld.service

 

配置mysql开机自启动:

[root@localhost ~]# systemctl enable mysqld.service

 

第一次登录,获取mysql的root用户初始化密码:

[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log

 

修改mysql的root用户的密码:

[root@localhost ~]# mysql -uroot -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

 

常见问题:

1、ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

需要使用ALTER USER修改密码。


2、ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

密码的复杂度不符合要求。

 

密码策略:

MySQL's validate_password plugin is installed by default. This will require that passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.

yum安装的默认密码策略:至少包含一个大写字符、一个小写字符、一个数字、一个特殊字符,并且密码总长度至少是8个字符。

添加用户:

[root@localhost ~]# mysql -uroot -p

mysql> use mysql;

mysql> CREATE USER '用户名'@'%' IDENTIFIED BY '密码';

mysql> grant all on 数据库名称.* to 'salt'@'%';

mysql> exit;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值