标签:arc lte shel yum cal led alter root repo
#下载mysql源安装包
shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# 安装mysql源
shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
shell> yum repolist enabled | grep "mysql.*-community.*"
安装MySQL
shell> yum install mysql-community-server
开机启动
shell> systemctl enable mysqld
shell> systemctl daemon-reload
/etc/my.cnf 新增如下三行
character_set_server=utf8
init_connect=‘SET NAMES utf8‘
validate_password = off 密码策略失效
常用命令:
shell> systemctl start mysqld
systemctl stop mysqld
systemctl restart mysqld
systemctl status mysqld
首次登录
mysql -uroot -p
密码使用如下查找到的_ZfwDGlsd0=g
[root@localhost /]# grep ‘temporary password‘ /var/log/mysqld.log
2018-05-21T11:55:15.515167Z 1 [Note] A temporary password is generated for root@localhost: _ZfwDGlsd0=g
修改用户名密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
显示字符集
show variables like ‘%character%‘;
修改密码
mysqladmin -uroot -pMyNewPass4! password a123456
//创建用户
CREATE USER ‘abc‘@‘host‘ IDENTIFIED BY ‘abc123456‘;
//刷新系统权限表
flush privileges;
用navicat for mysql连接
报错:1130 host is not allowed to connect to
解决办法,执行如下命令:
mysql -uroot -p
mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘;
mysql>select host, user from user;
mysql>flush privileges;
标签:arc lte shel yum cal led alter root repo
原文地址:https://www.cnblogs.com/mutong1228/p/9070929.html