linux 使用yum安装mysql

1:使用官方yum源

 参考:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

2:

wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm

sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

 

yum repolist all | grep mysql

 

sudo yum install mysql-community-server

 

查到mysql登录默认密码

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

登录

mysql -uroot -p

 

修改密码:

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

 

 

汉字存储:

show variables like 'character_set_%';

 

SET character_set_database = utf8 ;

 

show variables like 'character_set_%';

 

除filesystem外其他的value值不为utf8 也一律这样修改

my.cnf

[mysqld]

character-set-server=utf8
collation-server=utf8_general_ci

 

 其他常用命令

查询用户 访问权限和密码

select user,host,authentication_string from mysql.user;

 

新增用户

CREATE USER hug@localhost IDENTIFIED BY '123456';  

 grant all on mysql.* to hug@localhost;

update mysql.user set authentication_string =password('123456A?') where User="test" and Host="%";

flush privileges ;

 

posted on 2017-11-25 18:09  红色十月  阅读(638)  评论(0编辑  收藏  举报