cd /usr
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
systemctl start mysqld.service
vi /var/log/mysqld.log
输入:/temporary password
可以看到:A temporary password is generated for root@localhost: <你要找的临时密码>
mysql -u root -p
输入密码
set password for 'root'@'localhost'=password(‘新密码’);
1、编码
mysql配置文件为/etc/my.cnf
最后加上编码配置
[mysql]
default-character-set =utf8
这里的字符编码必须和/usr/share/mysql/charsets/Index.xml中一致。
<charset name="utf8">
<family>Unicode</family>
<description>UTF-8 Unicode</description>
<alias>utf-8</alias>
<collation name="utf8_general_ci" id="33">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
<collation name="utf8_bin" id="83">
<flag>binary</flag>
<flag>compiled</flag>
</collation>
</charset>
2、远程连接设置
mysql> grant all privileges on *.* to root@'%'identified by 'password';
果是新用户而不是root,则要先新建用户
mysql>create user 'username'@'%' identified by 'password';
修改:密码最小长度策略
mysql> set global validate_password_length=0;
修改:密码强度检查等级策略,0/LOW、1/MEDIUM、2/STRONG
mysql> set global validate_password_policy=0;
默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
使用如下命令操作mysql:
systemctl restart mysqld.service
systemctl start mysqld.service
systemctl stop mysqld.service