标签:图片 gre ges HERE password 文件 dmi The nic
CentOS yum安装mysql的大概步骤:
1. 配置yum源
下载mysql源安装包:wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装mysql源:yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功:yum repolist enabled | grep "mysql.*-community.*"
可以修改vim /etc/yum.repos.d/mysql-community.repo源,改变默认安装的mysql版本。比如要安装5.6版本,将5.7源的enabled=1改成enabled=0。然后再将5.6源的enabled=0改成enabled=1即可。
2. 安装mysql
yum install mysql-community-server
3. 启动MySQL:
systemctl start mysqld
4. 检查mysql运行状态:
systemctl status mysqld
5. 开机启动
systemctl enable mysqld
systemctl daemon-reload
6. 修改登陆密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
找到安装的初始密码:grep ‘temporary password‘ /var/log/mysqld.log
登陆:mysql -uroot -p
修改密码:ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘yourpasswd‘;(注意:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误)
7. 添加远程登陆账户
默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户,为了安全起见,我添加一个新的帐户:
GRANT ALL PRIVILEGES ON *.*
TIFIED BY ‘******‘ WITH GRANT OPTION;
对某个数据库,为某个用户授权:
create user ‘dev_fast‘@‘%‘ identified by ‘******‘;
grant all on fastadmin.* to ‘dev_fast‘@‘%‘;
修改root密码:
alter user ‘root‘@‘localhost‘ identified by ‘******‘;
update user set authentication_string=password(‘******‘) where user=‘root‘ and Host=‘%‘;
flush privileges;
8. 修改默认编码
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置:
character_set_server=utf8
init_connect=‘SET NAMES utf8‘
9.重启mysql
重启:systemctl restart mysqld
默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log//var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
标签:图片 gre ges HERE password 文件 dmi The nic
原文地址:https://www.cnblogs.com/jovic/p/10052431.html