[root@lzl ~]# mysql -uroot -P3307
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@lzl ~]#
[root@lzl ~]#
[root@lzl ~]#
[root@lzl ~]# ps -ef|grep 3307
mysql 10287 10202 0 11:03 pts/3 00:00:00 mysqld --defaults-file=/etc/my3307.cnf --skip-grant-tables
root 10334 10202 0 11:05 pts/3 00:00:00 grep 3307
[root@lzl ~]#
uj5u.com熱心網友回復:
估計沒有起左右再試試,看看版本 是不是資料庫密碼設定的方式不一樣uj5u.com熱心網友回復:
沒有起是什么意思?密碼設定方式?沒太明白
uj5u.com熱心網友回復:
嗯嗯 mysql 5.6 和5.7 設定密碼的時候 函式是不一樣的;如果是docker 里面安裝的話 還有一個 socket鏈接方式的的問題
uj5u.com熱心網友回復:
[root@lzl mysql]# mysql -uroot -p -S/tmp/mysql3307.sock
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@lzl mysql]# mysql -uroot -S/tmp/mysql3307.sock
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@lzl mysql]# mysql -uroot -S/tmp/mysql3307.sock -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
socket也不行
uj5u.com熱心網友回復:
把選項加在組態檔 my3307.cnf 里試試uj5u.com熱心網友回復:
可以試試這個方法uj5u.com熱心網友回復:
找到問題了,應該指定-h127.0.0.1 ,用tcpip登陸,就不需要密碼。默認不指定-h會使用socket
[root@lzl ~]# mysql -P3307 -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@lzl ~]# mysql -P3307 -uroot -p -h127.0.0.1
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
最后我也測驗了下把skip-grant-tables放在命令列和cnf里,都一樣的,-h就可以不要密碼登陸
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/10295.html
標籤:MySQL
