Problem: While connecting to MySQL from command line on MySQL 5.7, receiving the below error
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
Solution: To solve this problem, download an older version from the archives, say 5.6.28 and copy the “data” folder under mysql-5.6.28-winx64 to mysql-5.7.11-winx64
http://downloads.mysql.com/archives/community/
Once data folder is copied, open a command prompt in admin mode and navigate to bin directory and uninstall existing MSQL service
C:\mysql-5.7.11-winx64\bin>sc delete MySQL
After existing MySQL service is uninstalled, install MySQL service again
C:\mysql-5.7.11-winx64\bin>mysqld –install
Service successfully installed.
C:\mysql-5.7.11-winx64\bin>mysqld start
now open a commnad prompt and type services.msc, if MSQL service is not running, open the service and start.
Once the sercice is running, test the connection using MySQL Workbench. When trying to connect using workbench, you will receive the below error
Table ‘performance_schema.session_variables’ doesn’t exist
This is because we copied data folder from an older version of mysql to a new version. If you do not copy, mysql wont even start in the first place. To resolve performance_schema table issue, lets upgrade the mysql as shown below.
C:\mysql-5.7.11-winx64\bin>mysql_upgrade -u root -p –force
Enter password:
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK