mysql 5.7 centos 7_CentOS 7 下 MySQL 5.7 的安装与配置
注意:mysql 5.7 默認(rèn)安裝了密碼安全檢查插件(validate_password),默認(rèn)密碼檢查策略要求密碼必須包含:大小寫字母、數(shù)字和特殊符號,并且長度不能少于8位。否則會提示 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 錯誤。查看 MySQL官網(wǎng)密碼詳細(xì)策略
mysql> GRANT ALL PRIVILEGES ON *.* TO 'zhangsan'@'%' IDENTIFIED BY 'Password' WITH GRANT OPTION;
注意:
如果出現(xiàn)Access denied for user 'root'@'localhost' (using password: YES)
則修改my.cnf
vim /etc/my.cnf
加入skip-grant-tables
按【Esc】按鍵--》輸入【:wq】保存退出
重啟MySQL服務(wù)
systemctl restart mysqld
輸入mysql -u root -p,回車,不用輸入密碼
然后修改root的密碼為【root】
update mysql.user set authentication_string=password('root') where user='root';
最后把/etc/my.cnf中的【skip-grant-tables】刪掉或注釋,重啟mysql服務(wù)就可以了
修改 root 為允許遠(yuǎn)程連接(不推薦)
mysql>use mysql;
mysql> UPDATE user SET Host='%' WHERE User='root';
mysql> flush privileges;
設(shè)置默認(rèn)編碼為 utf8
mysql 安裝后默認(rèn)不支持中文,需要修改編碼。
修改?/etc/my.cnf?配置文件,在相關(guān)節(jié)點(沒有則自行添加)下添加編碼配置,如下:
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
重啟mysql服務(wù),查詢編碼。可以看到已經(jīng)改過來了
shell>systemctl restart mysqld
shell> mysql -uroot -p
mysql> show variables like 'character%';
默認(rèn)配置文件路徑:
配置文件:/etc/my.cnf
日志文件:/var/log/mysqld.log
服務(wù)啟動腳本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
總結(jié)
以上是生活随笔為你收集整理的mysql 5.7 centos 7_CentOS 7 下 MySQL 5.7 的安装与配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jsmodern_jQuery视频播放插
- 下一篇: python开发专属表情包_Python