1. 程式人生 > >ubuntu安裝mysql添加密碼

ubuntu安裝mysql添加密碼

沒有 cati ase nta ner use class mys space

ubuntu安裝mysql5.7後沒有密碼,添加密碼。

這裏是關鍵點,由於mysql5.7沒有password字段,密碼存儲在authentication_string字段中,password()方法還能用

在mysql中執行下面語句修改密碼

1 2 3 4 5 6 7 8 9 10 11 12 show databases; use mysql; update user set authentication_string=PASSWORD("自定義密碼") where user=‘root‘; update user
set plugin="mysql_native_password"; flush privileges; quit;

ubuntu安裝mysql添加密碼