How to start MySQL server on windows xp
Asked Answered
M

19

25

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?

Morphophoneme answered 2/10, 2009 at 12:8 Comment(0)
A
21

The MySQL server can be started manually from the command line. This can be done on any version of Windows.

To start the mysqld server from the command line, you should start a console window (or “DOS window”) and enter this command:

shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld"
The path to mysqld may vary depending on the install location of MySQL on your system.

You can stop the MySQL server by executing this command:

shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root shutdown

**Note : **

If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system. Note that users in the MySQL grant system are wholly independent from any login users under Windows.

If mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. The error log is located in the C:\Program Files\MySQL\MySQL Server 5.0\data directory. It is the file with a suffix of .err. You can also try to start the server as mysqld --console; in this case, you may get some useful information on the screen that may help solve the problem.

The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file C:\mysqld.trace that should contain the reason why mysqld doesn't start. See MySQL Internals: Porting to Other Systems.

Via MySQL Official Page

Aggrieved answered 15/12, 2012 at 9:1 Comment(0)
P
41

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
Party answered 27/9, 2016 at 5:4 Comment(3)
This is exactly what I was looking for. Thank you.Cardholder
For users that are trying to setup with some DB viewer like Speedment, you need to set a password. You can do that by running the initialize-insecure flag as mentioned above, and then running mysql> set password='yourPass'Cardholder
@JanacMeena where do I set the password?Alvertaalves
A
21

The MySQL server can be started manually from the command line. This can be done on any version of Windows.

To start the mysqld server from the command line, you should start a console window (or “DOS window”) and enter this command:

shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld"
The path to mysqld may vary depending on the install location of MySQL on your system.

You can stop the MySQL server by executing this command:

shell> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin" -u root shutdown

**Note : **

If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted.

This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL root user, which is the default administrative account in the MySQL grant system. Note that users in the MySQL grant system are wholly independent from any login users under Windows.

If mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. The error log is located in the C:\Program Files\MySQL\MySQL Server 5.0\data directory. It is the file with a suffix of .err. You can also try to start the server as mysqld --console; in this case, you may get some useful information on the screen that may help solve the problem.

The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file C:\mysqld.trace that should contain the reason why mysqld doesn't start. See MySQL Internals: Porting to Other Systems.

Via MySQL Official Page

Aggrieved answered 15/12, 2012 at 9:1 Comment(0)
S
17

If the command prompt does not work in Windows, try the following:

1) Open services in Windows.

2) Then check the status for Mysql and if you found status nothing or blank then start the mysql service.

MYSQL SERVICE STATUS ON Windows service manager

3) After then see whether the mysql is start or not .If it shows started then try to check mysql working.

It has worked for me when cmd commands were not working.

Simonsen answered 1/8, 2018 at 19:46 Comment(0)
L
8
  1. Run the command prompt as admin and cd to bin directory of MySQL

    Generally it is (C:\Program Files\MySQL\mysql-5.6.36-winx64\bin)
    
  2. Run command : mysqld --install. (This command will install MySQL services and if services already installed it will prompt.)

  3. Run below commands to start and stop server

    To start : net start mysql

    To stop : net stop mysql

  4. Run mysql command.

  5. Enjoy !!

Lust answered 27/5, 2017 at 10:58 Comment(0)
C
7

maybe

E:\mysql-5.1.39-win32\bin>mysql -u root -p
Coolidge answered 2/10, 2009 at 12:13 Comment(0)
B
5

Type

C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console

to start the sql server and then test the client connection.

Blas answered 9/5, 2012 at 12:54 Comment(0)
S
3

I was using MySQL Server 5.5 as a result I was missing the folder which majority of the answers made mention of in the bin folder. What I did instead was the following:

  1. Open Explorer and make your way to C:\Program Files\MySQL\MySQL Server 5.5\bin or your MySQL installation directory.
  2. Run the executable application MySQLInstanceConfig and follow the images below.

This solved my issue and I was able to access the database without any errors.

Stuffing answered 16/11, 2017 at 10:27 Comment(0)
L
2

Start mysql server by command prompt

C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --console

Or alternative reach up to bin then

mysqld --console

It will start your server.

If you have mysql command line client available

click on it

it show enter your password :

Please enter your password.

Then you can access it.

Leaven answered 20/6, 2014 at 9:36 Comment(0)
R
1

You also need to configure and start the MySQL server. This will probably help

Rickyrico answered 2/10, 2009 at 12:18 Comment(0)
I
1

I tried following steps to run mysql server 5.6 on my windows 8.

  1. Run command prompt as an administrator
  2. go mysql server 5.6 installation directory (in my case: C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin) copy that location
  3. In Command prompt run "cd C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin"
  4. run "mysql -u root"
Indescribable answered 24/4, 2015 at 6:29 Comment(0)
B
0

You need to run the server first. The command you use (in the question) starts a client to connect to the server but the server is not there so there the error.

Since I am not a Windows user (Linux comes equipped) so I might not be the best person to tell you how but I can point to you to a guide and another guide that show you how to get MySQL server up and running in Windows.

After you get that running, you can use the command (in the question) to connect it.

NOTE: You may also try http://www.apachefriends.org/en/xampp.html if you plan to use MySQL for web database development.

Hope this helps.

Biddy answered 2/10, 2009 at 12:17 Comment(0)
D
0

The error complains about localhost rather than permissions and the current practice in MySQL is to have a bind-address specifying localhost only in a configuration file.

So I don't think it's a password problem - except that you say you 'unzipped' MySQL.

Is that enough installation? What did you download?

Was there any installation step which allowed you to define a root password?

And, as NawaMan said, is the server running?

Denary answered 2/10, 2009 at 12:20 Comment(0)
N
0

first thing you need to do is to start the mysql for that you can use E:\mysql-5.1.39-win32\bin>net start mysql (only when there a mysql running as service) then you can execute E:\mysql-5.1.39-win32\bin>mysql -u root

Nuri answered 23/3, 2012 at 7:50 Comment(0)
B
0
  • Run your command prompt as administrator.#

We can start MySQL service from windows command line using the below command.

  • net start mysql

Command to stop MySql service:

  • net stop mysql

Disable MySql service:

  • sc config mysql start= disabled

Command to enable MySql service(to automatically start MySQL service when the system starts up):

  • sc config mysql start= auto

Command to set the startup type to manual:

  • sc config mysql start= manual

How to restart MySql service? There is no direct command to restart a service. You can combine stop and start commands like below.

  • net stop mysql & net start mysql
Beera answered 26/4, 2014 at 3:1 Comment(1)
how do you install mysql as a service? it says The service name is invalidWhity
G
0

probably this will help you I was also having problem with starting MySql server but run command as mention right mark in picture . Its working fine .

Gravy answered 18/9, 2014 at 6:22 Comment(0)
T
0
mysql -u root -p

After entering this command in terminal, it will ask for password Enter the password and you are ready to go!

Threepence answered 3/11, 2017 at 8:47 Comment(0)
B
0

there is one of the best solution do resolve this problem and it is going to work 100%. as we know that server is a process so treat it like a process go to the task manager in windows and see for services in task manager in that service see for Mysql and MS80 and try to start it manually by click on it and say run then will take some time.

go to your mysql workbench and click on start/shutdown then try to refresh the server status in server status option. it will load up thats it.

Beardsley answered 6/9, 2018 at 10:36 Comment(1)
Are you sure about this? This will only work if MySQL was installed as a service, and as the OP wrote, he only unzipped a packagePuga
B
0

1.Open a command prompt as Administrator.

2.Go to MySQL installed bin directory in program files.

3.Copy the location of the bin directory from windows explorer.

4.In command prompt type cd and (paste the location) and do enter.

5.Type mysqld --initialize

6.Open services from the windows menu and sort the list by name.

7.Right-click Mysql and click start.

Ballplayer answered 3/3, 2021 at 10:53 Comment(0)
C
-1

use the command "mysql -u root -p" in the bin folder path. and give the MY SQL password which you have set earlier.

Chee answered 15/11, 2019 at 17:53 Comment(1)
The question about starting the MySQL server, not on how to to authenticate the root user using the MySQL client.Xanthine

© 2022 - 2024 — McMap. All rights reserved.