MySQL 配置

Linux(Ubuntu)

root@ubuntu-virtual-machine:~# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?    # 要安裝驗(yàn)證密碼插件嗎?

Press y|Y for Yes, any other key for No: N    # 這里我選擇N
Please set the password for root here.

New password:   # 輸入要為root管理員設(shè)置的數(shù)據(jù)庫(kù)密碼

Re-enter new password:   # 再次輸入密碼


By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y     # 刪除匿名賬戶
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N    # 禁止root管理員從遠(yuǎn)程登錄,這里我沒有禁止

... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y   # 刪除test數(shù)據(jù)庫(kù)并取消對(duì)它的訪問權(quán)限
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y   # 刷新授權(quán)表,讓初始化后的設(shè)定立即生效
Success.

All done!

如果這樣還是不行,沒有效果

先進(jìn)Mysql

mysql -uroot
>use mysql;
>select * from user where User='root';
//這里肯定會(huì)顯示一大堆東西,其實(shí)是因?yàn)楸頇M向太長(zhǎng),顯示不全的原因
+---------------------------------+-------------------------------------------------------------------------------+
| plugin                          | authentication_string                                                         |
+---------------------------------+-------------------------------------------------------------------------------+
| mysql_native_password           | *84AAC12F54AB666ECFC2A83C676908C8BBC381B1                                     |
+---------------------------------+-------------------------------------------------------------------------------+
把這兩個(gè)地方改成這樣就行了
>update user set plugin='mysql_native_password',authentication_string='*84AAC12F54AB666ECFC2A83C676908C8BBC381B1' where User='root';

這樣你的root用戶密碼,就改成了12345678
可以盡情的學(xué)數(shù)據(jù)庫(kù)了。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容