2013-04-02 2 views
11

정말 슬프지만 MySQL 데이터베이스에 연결할 수 없습니다.mysql : 사용자 'root'@ 'localhost'에 대한 액세스가 거부되었습니다.

단순히 donwloaded와 MySQL 사이트에서 압축을 푼 mysql-5.6.10-win32.zip.

나는 this tutorial을 따라,하지만 난 루트로 내 MySQL 데이터베이스에 연결할 수 아니에요.

비밀 번호가없는 루트로 연결하는 것이 안전하지 않다는 것을 알고 있지만 몇 가지 테스트가 필요하기 때문에 지금 당장 할 수 있습니다. (그리고 내가 루트로 연결하는 방법을 알고 있다면 다른 사용자도 추가 할 수 있습니다.) 내가 mysqld를 시작하면

은의 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 --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에있는 명령, 그리고 나는 그들이 도움을 기대 몇 가지 다른를 포함

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; 

하지만 아직 로그인 할 수 없습니다.

내가 노력 로그인하려면 다음 몇 가지 튜토리얼에서는

>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 명령을 읽을 수 있지만 너무 루트 암호가 필요합니다.

나는 빈 암호와 mysql을 기본 암호로 사용하고 아무 것도 시도하지 않았습니다.

내가 성공하지 않고 또한 --skip-grant-tables했습니다.

나는 MySQL의 홈 디렉토리의 bin 디렉토리에서 mysqld_safe에없는, 그래서 나는 그것을 시도 할 수 없었다.

나는 여기에 그 문제와 관련된 모든 질문에 읽으려고하지만, 나는이 아직까지 시도 할 수 무슨 생각이 ...

"& 실행을 다운로드대로 간단하지 않습니다 왜 좌절 해요 ". 나는 내 PC를 -h 지정 연결해야한다는,

+0

의 경우, 새로 설치 당신이 언급 한 것처럼, 당신은 터미널에서 영구적 인 한 –

+0

시도'mysql_secure_installation'을하지 않으려는 경우에도 임시 비밀번호가 뿌리 추가에서 당신을 금지 것. – hjpotter92

+0

로그인해야하는 명령은 무엇입니까? – Najzero

답변

4

난 그냥 발견 ... 내가 서비스를 Windows 시작 및 제어없이 내 시스템에 복사 다른 것들에 시작하지 않기 때문에, 승리의 설치 프로그램을 다운로드하고 싶지 않아 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을 지정하여 해결했습니다.INI :

bind-address=localhost 
관련 문제