mysql有時會出現error 1045 (28000): access denied for user 'root'@'localhost' (using password: yes)
的錯誤解決方法如下
在[mysqld]下面新增skip-grant-tables,這樣就可以實現無密碼登入
redhat linux (fedora core/cent os)
1.啟動:/etc/init.d/mysqld start
2.停止:/etc/init.d/mysqld stop
3.重啟:/etc/init.d/mysqld restart
debian / ubuntu linux
1.啟動:/etc/init.d/mysql start
2.停止:/etc/init.d/mysql stop
3.重啟:/etc/init.d/mysql restart
windows:
1.啟動:輸入 net stop mysql
2.停止:輸入 net start mysql
下面是操作流程圖
enter password: ********
welcome to
the mysql monitor. commands end
with ; or \g.
your mysql connection id
is12
server version: 5.7
.18-log mysql community server (gpl)
oracle is a registered trademark of oracle corporation and/or
itsaffiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql> use mysql;
database changed
mysql> select user from user; #此處為查詢使用者命令
+-----------+
| user |
+-----------+
| ******* |
| mysql.sys |
| root |
+-----------+
rows in
set (0.00 sec)
mysql> update user set password=password("*******") where user="*******"; #舊版本使用,修改密碼報錯
error 1054 (42s22): unknown column 'password' in 'field list'
mysql> update mysql.user set authentication_string=password('*******') where user='*******'; #新版本,修改密碼成功
query ok, 1 row affected, 1 warning (0.00 sec)
rows matched: 1 changed: 1 warnings: 1
mysql> flush privileges; #立即生效
query ok, 0 rows affected (0.00 sec)
mysql> quit
byen>mysql -u ******* -p #以該使用者登入成功.
enter password: ********
…………………………
mysql>
重置mysql 密碼 mysql重置密碼
ubuntu下重置mysql的root密碼 sudo vi etc mysql my.cnf,在 mysqld 段中加入一行 skip grant tables sudo service mysql restart,重啟mysql服務 sudo mysql u root p mysql,用空密碼進入...
mysql 重置密碼 mysql 重置密碼
mysql 重置密碼 版本5.7之前 1 修改mysql配置檔案 vi etc my.cnf 注 windows下修改的是my.ini 在 mysqld 後面任意一行新增 skip grant tables 用來跳過密碼驗證的過程。重啟mysql 2 進入mysql root localhost m...
重置評 mysql密碼 重置mysql密碼
以下解決方法在此url中 當使用 mysql uroot p 時,提示下面錯誤 error 1045 28000 access denied for user root localhost using password no 那麼我們可以重置密碼 etc init.d mysql stop 先停止m...