2013-04-02 27 views
11

本当に悲しいですが、MySQLデータベースに接続できません。Mysql:ユーザー 'root' @ 'localhost'のアクセスが拒否されました

MySQLサイトからmysql-5.6.10-win32.zipを単純にアンドロードして解凍しました。

私はthis tutorialに従っていますが、MySQLデータベースにrootとして接続できません。

パスワードなしでrootとして接続するのは安全ではないことが分かっていますが、テストをするだけで済みますので、今すぐにしても構いません(ルートとして接続する方法を知っていれば、別のユーザーを追加することもできます)。

のmy.ini

# For advice on how to change settings please see 
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html 
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the 
# *** default location during install, and will be replaced if you 
# *** upgrade to a newer version of MySQL. 

[mysqld] 

# Remove leading # and set to the amount of RAM for the most important data 
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 
# innodb_buffer_pool_size = 128M 

# Remove leading # to turn on a very important data integrity option: logging 
# changes to the binary log between backups. 
# log_bin 

# These are commonly set, remove the # and set as required. 
basedir=c:\Programs\mysql-5.6.10-win32 
datadir=c:\Programs\mysql-5.6.10-win32\data 
port=3306 
server_id=1 


# Remove leading # to set options mainly useful for reporting servers. 
# The server defaults are faster for transactions and fast SELECTs. 
# Adjust sizes as needed, experiment to find the optimal values. 
# join_buffer_size = 128M 
# sort_buffer_size = 2M 
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

[client] 

port=3306 

私はmysqldを起動すると、私は次を参照してください。

UPDATE mysql.user SET Password=PASSWORD('pass') WHERE User='root'; 
grant all privileges on *.* to 'root'@'%'; 
grant all privileges on *.* to 'root'@'localhost'; 
grant all privileges on *.* to '[email protected]'; 

SHOW GRANTS FOR 'root'@'%'; 

FLUSH PRIVILEGES; 

> mysqld --console --init-file=..\set_root_password.sql 
2013-04-02 13:48:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2013-04-02 13:48:24 8600 [Note] Plugin 'FEDERATED' is disabled. 
2013-04-02 13:48:24 8600 [Note] InnoDB: The InnoDB memory heap is disabled 
2013-04-02 13:48:24 8600 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 
2013-04-02 13:48:24 8600 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2013-04-02 13:48:24 8600 [Note] InnoDB: CPU does not support crc32 instructions 
2013-04-02 13:48:24 8600 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2013-04-02 13:48:24 8600 [Note] InnoDB: Completed initialization of buffer pool 
2013-04-02 13:48:24 8600 [Note] InnoDB: Highest supported file format is Barracuda. 
2013-04-02 13:48:24 8600 [Note] InnoDB: 128 rollback segment(s) are active. 
2013-04-02 13:48:24 8600 [Note] InnoDB: Waiting for purge to start 
2013-04-02 13:48:24 8600 [Note] InnoDB: 1.2.10 started; log sequence number 1626183 
2013-04-02 13:48:24 8600 [Note] Server hostname (bind-address): '*'; port: 3306 
2013-04-02 13:48:24 8600 [Note] IPv6 is available. 
2013-04-02 13:48:24 8600 [Note] - '::' resolves to '::'; 
2013-04-02 13:48:24 8600 [Note] Server socket created on IP: '::'. 
2013-04-02 13:48:24 8600 [Note] Event Scheduler: Loaded 0 events 
2013-04-02 13:48:24 8600 [Note] Execution of init_file '..\set_root_password.sql' started. 
2013-04-02 13:48:24 8600 [Note] Execution of init_file '..\set_root_password.sql' ended. 
2013-04-02 13:48:24 8600 [Note] mysqld: ready for connections. 
Version: '5.6.10' socket: '' port: 3306 MySQL Community Server (GPL) 

set_root_password.sqlは、いくつかの私がHow to reset root passwordの中のコマンド、と私は、彼らが助け望んいくつかの他が含まれています

まだログインできません。

私が試しにログインするには、次のいくつかのチュートリアルで

>mysql -u root 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 

>mysql -u root --password=pass 
Warning: Using a password on the command line interface can be insecure. 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 

>mysql 
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) 

>mysql -u root --password= 
Warning: Using a password on the command line interface can be insecure. 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 

>mysql -u root --password=mysql 
Warning: Using a password on the command line interface can be insecure. 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 

>mysql -u root mysql 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 

>mysqladmin --no-defaults -u root version 
mysqladmin: connect to server at 'localhost' failed 
error: 'Access denied for user 'root'@'localhost' (using password: NO)' 

を私はおよそmysqladminコマンドを読みますが、それはあまりにもrootパスワードが必要です。

私も空のパスワードとmysqlをデフォルトのパスワードとして試しましたが、何もwokrdしませんでした。

私も--skip-grant-tablesを試しましたが、成功しませんでした。

私はMySQLホームディレクトリのbinディレクトリにmysqld_safeを持っていないので、私はそれを試すことができませんでした。

「&実行をダウンロードするように単純ではありませんなぜ私はイライラしてる

...私はその問題に関連し、ここですべての質問を読み込もうとしましたが、私はまだしようとすることができますどのような見当がつかない"私はWindowsのスタートアップや他のものがコントロールなしで私のシステムにコピーされたサービスを開始したくないので、Winインストーラをダウンロードしたくない...

+0

あなたのような新鮮なインストールが言及した場合、どのようなあなたは永久的な1 –

+0

は '端末からmysql_secure_installation'を試してみたくない場合でも、rootに一時的なパスワードを追加することからあなたを禁止します。 – hjpotter92

+0

私は、どんなコマンドでログインしようとしていますか;-)を問わなければなりませんか? – Najzero

答えて

4

私はちょうど見つかった、正常に動作します

ipconfig -all

>ipconfig -all 

Windows IP Configuration 

    Host Name . . . . . . . . . . . . : PC1234 
    Primary Dns Suffix . . . . . . . : 
    Node Type . . . . . . . . . . . . : Hybrid 
    IP Routing Enabled. . . . . . . . : No 
    WINS Proxy Enabled. . . . . . . . : No 
    DNS Suffix Search List. . . . . . : tmdev 

mysql -u root -h PC1234 --password=pass 
から名前を付けます。手伝ってくれてありがとう。それは奇妙ですが、今はうまくいきます。

編集:

私はその構成に接続するための問題を抱えていました。私はbind-addressをmyに指定して解決しました。INI:

bind-address=localhost 
関連する問題