ERROR 2003 (HY000): Can't connect to MySQL server on localhost (10061)

后端 未结 26 1969
Happy的楠姐
Happy的楠姐 2020-12-23 02:37

I installed MySQL on Microsoft Windows 8 Using a noinstall Zip Archive. But when i tested by executing the following commands on windows prompt, the above error showed up.<

相关标签:
26条回答
  • 2020-12-23 02:43

    If you're using the no install zip, you need to execute mysqld.exe first to start the service, and then execute mysql.exe to open your connection.

    The no install is nice, but if you intend to do any serious work with MySQL, you may want to consider either using the MSI to do a proper installation, or if you're doing web development work give XAMPP a try.

    0 讨论(0)
  • 2020-12-23 02:43

    I had a problem with most of these solutions . The fact that I couldn't find the bin folder in my c drive. I tried solution offered here " https://www.howtosolutions.net/2017/08/fixing-mysql-10061-error-after-migration-of-database-files/ "and vwala "welcome to the mysql monitor ...."

    0 讨论(0)
  • 2020-12-23 02:46

    Despite that my server was running, I had the same problem. I found out that it was the port. So you need to specify the port:

    mysql -u user -p --port 0000
    

    The port on your machine may be different. To find out on which port mysql is running open the mysql ini file and look for port=. A port often used is 3306.

    Example how to log on to mysql

    mysql -u root -p --port 3306 
    
    0 讨论(0)
  • 2020-12-23 02:46

    First of all, you need to ensure the port number on which the server is running. Then you can run

    mysql -u username -p --port portNumber on the command line

    0 讨论(0)
  • 2020-12-23 02:46

    In my case I have 2 different version of mysql in Windows OS and I solved the my problem by bottom step:

    first stop all mysql service.

    I create one config file in C:\mysqldata.cnf with bottom data(my mysql is in "C:/mysql-5.0.96-winx64" directory ):

    [mysqld]
    datadir = C:/mysql-5.0.96-winx64/data
    port = 3307
    

    then I run bottom command in cmd:

    C:\mysql-5.0.96-winx64\bin\mysqld --defaults-file=C:\mysqldata.cnf --console
    

    above step reference

    then I create txt file in C:\resetpass.txt with bottom data:

    UPDATE mysql.user SET password=PASSWORD('ttt') WHERE user='root';
    

    then run mysqld with bottom command:

    C:\mysql-5.0.96-winx64\bin\mysqld --init-file=C:\resetpass.txt --install mysql2 --console
    net start mysql2
    

    after these step you have one mysql service(with name mysql2) than run with port 3307.

    I have 2 version of mysql with different user management tables(in version 5.0.96 user table difference with 5.5 version because of that I must be change table folder in first step)

    you can run other mysql service with other port now(and you can run this steps with different datadir, service name and port for it again)

    0 讨论(0)
  • 2020-12-23 02:47

    The solution that worked for me is:

    1. Downloaded mysql-8.0.22-winx64.zip file
    2. Extracted the zip file
    3. Moved the extracted folder to C:/Program Files
    4. Opened cmd.exe as admin
    5. Navigated to the directory cd C:\Program Files\mysql-8.0.22\mysql-8.0.22-winx64\bin
    6. mysqld -install (Service successfully installed)
    7. mysqld --initialize (no prompt)
    8. Opened services.msc
    9. Found MySQL
    10. Right-click and start

    Let me know if it helps!

    0 讨论(0)
提交回复
热议问题