时间:2021-07-01 10:21:17 帮助过:34人阅读
CentOS7;Mysql5.7
# 获取依赖
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
# 安装依赖
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
# 在线安装mysql
yum -y install mysql-community-server
# 设置开机启动
systemctl enable mysqld
systemctl daemon-reload
mysql安装完成之后,会在/var/log/mysqld.log文件中给root生成了一个临时的默认密码。
获取这个初始密码: vim /var/log/mysqld.log
修改密码:
mysql -u root -p #输入刚刚获取的密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456‘; # 进入mysql命令行后,修改密码
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION; # 设置远程登录
打开配置文件:vim /etc/my.cnf`
添加内容:
character_set_server=utf8
init_connect=‘SET NAMES utf8‘
重启:systemctl restart mysqld
Mysql-安装
标签:dev 打开 ble 进入 install strong mys 命令行 wget