腾讯云centos7.2安装mysql

2018-05-23  本文已影响49人  349ff5da91d8

安装mysql

下载mysql源安装包

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

安装mysql源

yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-devel

安装MySQL

yum install mysql-community-server

启动MySQL服务

systemctl start mysqld

查看MySQL的启动状态

systemctl status mysqld

开机启动

systemctl enable mysqld

修改root本地登录密码

grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
set password for 'root'@'localhost'=password('!2Qw32sd');

注意:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误

配置默认编码为utf8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:

[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'

[远程连接腾讯云MySQL数据库]
输入mysql -uroot -p,使用Mysql
use mysql
update user set host = '%' where user = 'root'
select host ,user,password from user;
grant all privileges on . to 'root'@'%' identified by 'root' with grant option;
flush privileges;

上一篇下一篇

猜你喜欢

热点阅读