Mysql-安装指南
?
?
?
1、設(shè)置用戶名密碼
首次登錄后修改密碼如下:
如果密碼設(shè)置太過簡單會(huì)報(bào)以下錯(cuò)誤
mysql修改密碼Your password does not satisfy the current policy requirements
出現(xiàn)這個(gè)問題的原因是:密碼過于簡單。剛安裝的mysql的密碼默認(rèn)強(qiáng)度是最高的,如果想要設(shè)置簡單的密碼就要修改validate_password_policy的值,
validate_password_policy有以下取值:
?
| 0?or?LOW | Length |
| 1?or?MEDIUM | Length; numeric, lowercase/uppercase, and special characters |
| 2?or?STRONG | Length; numeric, lowercase/uppercase, and special characters; dictionary file |
默認(rèn)是1,因此我們就設(shè)置中增加大小寫和特殊字符即可。
?
2、配置允許外網(wǎng)連接
?
?
2.登錄數(shù)據(jù)庫
mysql -u root -p
#輸入密碼
3.轉(zhuǎn)到系統(tǒng)數(shù)據(jù)庫
mysql> use mysql;
4.查詢host
mysql> select user,host from user;
5.創(chuàng)建host
#如果沒有"%"這個(gè)host值,就執(zhí)行下面這兩句:
mysql> update user set host='%' where user='root';
mysql> flush privileges;
6.授權(quán)用戶
#任意主機(jī)以用戶root和密碼mypwd連接到mysql服務(wù)器
mysql> grant all privileges on *.* to 'root'@'%' identified by 'mypwd' with grant option;
#IP為192.168.1.100的主機(jī)以用戶myuser和密碼mypwd連接到mysql服務(wù)器
mysql> grant all privileges on *.* to 'myuser'@'192.168.1.100' identified by 'mypwd' with grant option;
7.刷新權(quán)限
mysql> flush privileges;
操作截圖如下:
?
?
?
?
忘記密碼參考:
CentOS7 通過YUM安裝MySQL5.7
參考:
1?設(shè)置MySQL允許外網(wǎng)訪問
2?CentOS7 通過YUM安裝MySQL5.7
?
轉(zhuǎn)載于:https://www.cnblogs.com/snowwhite/p/9903477.html
總結(jié)
以上是生活随笔為你收集整理的Mysql-安装指南的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ubuntu Docker安装
- 下一篇: mysql与Json学习总结