How to start MySQL server on windows xp

Dusk picture Dusk · Oct 2, 2009 · Viewed 246.6k times · Source

Whenever I try to start MySQL by typing

> mysql -u root

I get the error

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

How can I solve the problem above? I just downloaded MySQL and unzipped it in the E: drive. I have not done anything else. Do I have to make a connection first? If so, how can I do that?

Answer

George Ninan picture George Ninan · Sep 27, 2016

Here is the ZIP file that I had downloaded: mysql-5.7.15-winx64.zip

Here are the steps to start MYSQL Server (mysql-5.7.15-winx64) for the first time on Windows:

  1. Create a new folder named "data" in MYSQL installation directory (i.e. in the same location as where "bin" directory is located. For me it is: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64. This location will vary as per the location where you have extracted the MYSQL zip file)
  2. From here I will use my MYSQL folder location as reference. Go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute the command: mysqld --initialize-insecure or mysqld --initialize depending on whether you want the server to generate a random initial password for the 'root'@'localhost' account.
  3. To start the DB, go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute mysqld --console You can see the start-up logs being printed.
  4. To connect to DB, go to: C:\programs\mysql-5.7.15-winx64\mysql-5.7.15-winx64\bin and execute mysql -u root -p. When prompted, Enter password if it has been set or else just hit "Enter" button to connect