2

データベースのMySQLサーバーに接続しようとしていますが、コンソールERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)に理由がわかりません。私を助けてください。私のファイルmy.cnfには、次のようなものがあります。

[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# To allow mysqld to connect to a MySQL Cluster management daemon, uncomment
# these lines and adjust the connectstring as needed.
#ndbcluster
#ndb-connectstring="nodeid=4;host=localhost:3306"

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[ndbd]
# If you are running a MySQL Cluster storage daemon (ndbd) on this machine,
# adjust its connection to the management daemon here.
# Note: ndbd init script requires this to include nodeid!
connect-string="nodeid=2;host=localhost:3306"

[ndb_mgm]
# connection string for MySQL Cluster management tool
connect-string="host=localhost:3306"

[client]
socket=/tmp/mysql.sock

ここに画像の説明を入力してください

ありがとう。

4

2 に答える 2

3

パスを本当に覚えていない場合は、サーバーを再起動して、サーバーのセクションに追加できskip_grant_tablesます[mysqld]my.cnfパスワードなしで入力できます。次に、テーブルを更新してパスワードを変更mysql.userし、オプションを削除してmysqlを再起動skip_grant_tablesできます。

于 2012-08-05T18:55:38.630 に答える
0

-pフラグは、パスワードの要件を示します。入力した内容を入力した後、パスワードを要求する2番目のプロンプトが表示されます。例えば:

$ mysql -u root -p
$ Enter password: 

次に、パスワードを入力します。

于 2012-08-05T18:46:11.873 に答える