您好,登錄后才能下訂單哦!
mysql 中怎么修改root密碼,相信很多沒有經(jīng)驗(yàn)的人對此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。
Method 1:
在/usr/local//bin/下:
./mysqladmin -u root password new_password
一般安裝時(shí)用此方法設(shè)置。
Method 2:
在mysql狀態(tài)下:
mysql>UPDATE user SET password=PASSWORD(new_password) WHERE user=root;
mysql>FLUSH PRIVILEGES;
Method 3:
mysql>SET PASSWORD FOR root=PASSWORD(new_password);
有人會問如果不知道m(xù)ysql root的密碼情況下,是否可以修改密碼呢?答案:可以的,想知道方法請繼續(xù)往下看:
只有在mysqld啟動的時(shí)候加上 --skip-grant-tables就ok,
例:
[root@server]# /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
[root@server]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 7
Server version: 5.0.45-log Source distribution
Type help; or h for help. Type c to clear the buffer.
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password(******)where user=root;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
看完上述內(nèi)容,你們掌握mysql 中怎么修改root密碼的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。