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?    # 要安裝驗證密碼插件嗎?

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ù)庫密碼

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ù)庫并取消對它的訪問權(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!

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

先進Mysql

mysql -uroot
>use mysql;
>select * from user where User='root';
//這里肯定會顯示一大堆東西空镜,其實是因為表橫向太長,顯示不全的原因
+---------------------------------+-------------------------------------------------------------------------------+
| plugin                          | authentication_string                                                         |
+---------------------------------+-------------------------------------------------------------------------------+
| mysql_native_password           | *84AAC12F54AB666ECFC2A83C676908C8BBC381B1                                     |
+---------------------------------+-------------------------------------------------------------------------------+
把這兩個地方改成這樣就行了
>update user set plugin='mysql_native_password',authentication_string='*84AAC12F54AB666ECFC2A83C676908C8BBC381B1' where User='root';

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市革半,隨后出現(xiàn)的幾起案子碑定,更是在濱河造成了極大的恐慌,老刑警劉巖又官,帶你破解...
    沈念sama閱讀 218,858評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件延刘,死亡現(xiàn)場離奇詭異,居然都是意外死亡赏胚,警方通過查閱死者的電腦和手機访娶,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,372評論 3 395
  • 文/潘曉璐 我一進店門商虐,熙熙樓的掌柜王于貴愁眉苦臉地迎上來觉阅,“玉大人,你說我怎么就攤上這事秘车〉溆拢” “怎么了?”我有些...
    開封第一講書人閱讀 165,282評論 0 356
  • 文/不壞的土叔 我叫張陵叮趴,是天一觀的道長割笙。 經(jīng)常有香客問我,道長眯亦,這世上最難降的妖魔是什么伤溉? 我笑而不...
    開封第一講書人閱讀 58,842評論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮妻率,結(jié)果婚禮上乱顾,老公的妹妹穿的比我還像新娘。我一直安慰自己宫静,他們只是感情好走净,可當(dāng)我...
    茶點故事閱讀 67,857評論 6 392
  • 文/花漫 我一把揭開白布券时。 她就那樣靜靜地躺著,像睡著了一般伏伯。 火紅的嫁衣襯著肌膚如雪橘洞。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,679評論 1 305
  • 那天说搅,我揣著相機與錄音炸枣,去河邊找鬼。 笑死弄唧,一個胖子當(dāng)著我的面吹牛抛虏,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播套才,決...
    沈念sama閱讀 40,406評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼迂猴,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了背伴?” 一聲冷哼從身側(cè)響起沸毁,我...
    開封第一講書人閱讀 39,311評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎傻寂,沒想到半個月后息尺,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,767評論 1 315
  • 正文 獨居荒郊野嶺守林人離奇死亡疾掰,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,945評論 3 336
  • 正文 我和宋清朗相戀三年搂誉,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片静檬。...
    茶點故事閱讀 40,090評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡炭懊,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出拂檩,到底是詐尸還是另有隱情侮腹,我是刑警寧澤,帶...
    沈念sama閱讀 35,785評論 5 346
  • 正文 年R本政府宣布稻励,位于F島的核電站父阻,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏望抽。R本人自食惡果不足惜加矛,卻給世界環(huán)境...
    茶點故事閱讀 41,420評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望煤篙。 院中可真熱鬧斟览,春花似錦、人聲如沸舰蟆。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,988評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至味悄,卻和暖如春草戈,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背侍瑟。 一陣腳步聲響...
    開封第一講書人閱讀 33,101評論 1 271
  • 我被黑心中介騙來泰國打工唐片, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人涨颜。 一個月前我還...
    沈念sama閱讀 48,298評論 3 372
  • 正文 我出身青樓费韭,卻偏偏與公主長得像,于是被迫代替她去往敵國和親庭瑰。 傳聞我的和親對象是個殘疾皇子星持,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,033評論 2 355

推薦閱讀更多精彩內(nèi)容