This article MySQL installation environment is Win7 64 bit, MySQL version is MySQL5.7
Problem Description: Enter Mysql-u root-p on the command line to log in to MySQL and return "Can ' t connect to MySQL server on localhost (10061)" Error
Problem reason: In a Google, Baidu, found that the problem is that MySQL did not start.
WORKAROUND: 1. Add MySQL to the services of Windows. Switch to the Bin folder in the MySQL installation directory, run "Mysqld--install" on the command line
1 5.7 mysqld--install 2 Service successfully installed.
If you successfully start MSYQL using "net start MySQL", you do not need to perform the following steps
2. Initialize the MySQL database and enter "Mysqld--initialize--user=root--console". The following red text is the root password after initialization
C:\Program Files\mysql\mysql Server5.7\bin>mysqld--initialize--user=root--Console .-Ten-29T01: *: -.309833Z0[Warning] TIMESTAMP withImplicitDEFAULT value isdeprecated. please use--explicit_defaults_for_timestamp server Option (see documentation forMore details). .-Ten-29T01: *: $.659968Z0[Warning] Innodb:new log files created, lsn=45790 .-Ten-29T01: *: -.154996Z0[Warning] innodb:creating foreign key constraintsystem tables. .-Ten-29T01: *: -.362008Z0[Warning] No existing UUID have been found, so we assume that This isThe first time that Thisserver has been started. GeneratingaNewuuid:043563f4-9d78-11e6-a8c8-606dc79c383c. .-Ten-29T01: *: -.388009Z0[Warning] Gtid table isNot ready to be used. Table'mysql.gtid_executed'cannot be opened. .-Ten-29T01: *: -.401010Z1[Note] A Temporary password isGenerated for[Email protected]:u). IG. GD.7HW
3. Use "net start MySQL" to start msyql successfully at this time
4. Use the generated password to log in to MySQL and change the password via "Set Password=password (' 123456 ')". The root password is set to 123456 here
set password=password ('123456'01 Warning ( 0.00 sec)
MySQL problem logging--can ' t connect to MySQL server on localhost (10061) workaround