Reputation: 2201
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?
Upvotes: 25
Views: 284576
Reputation: 340
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.
Upvotes: 0
Reputation: 181
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)
Run command : mysqld --install. (This command will install MySQL services and if services already installed it will prompt.)
Run below commands to start and stop server
To start : net start mysql
To stop : net stop mysql
Run mysql command.
Enjoy !!
Upvotes: 8
Reputation: 1
use the command "mysql -u root -p" in the bin folder path. and give the MY SQL password which you have set earlier.
Upvotes: -1
Reputation: 31
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.
Upvotes: 0
Reputation: 171
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.
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.
Upvotes: 17
Reputation: 14540
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:
C:\Program Files\MySQL\MySQL Server 5.5\bin
or your MySQL installation directory.MySQLInstanceConfig
and follow the images below.This solved my issue and I was able to access the database without any errors.
Upvotes: 3
Reputation: 9
mysql -u root -p
After entering this command in terminal, it will ask for password Enter the password and you are ready to go!
Upvotes: 0
Reputation: 2097
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:
mysqld --initialize-insecure
or mysqld --initialize
depending on whether you want the server to generate a random initial password for the 'root'@'localhost' account.mysqld --console
You can see the start-up logs being printed.mysql -u root -p
. When prompted, Enter password if it has been set or else just hit "Enter" button to connectUpvotes: 41
Reputation: 20766
I tried following steps to run mysql server 5.6 on my windows 8.
Upvotes: 1
Reputation: 1391
I was also having problem with starting MySql server but run command as mention right mark in picture . Its working fine .
Upvotes: 0
Reputation: 573
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.
Upvotes: 2
Reputation: 1750
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
Upvotes: 0
Reputation: 3078
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.
Upvotes: 21
Reputation: 49
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
Upvotes: 0
Reputation: 79
Type
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
to start the sql server and then test the client connection.
Upvotes: 5
Reputation: 15118
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?
Upvotes: 0
Reputation: 13468
You also need to configure and start the MySQL server. This will probably help
Upvotes: 1
Reputation: 25687
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.
Upvotes: 0