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?
This question is related to
mysql
windows-xp
mysql-error-2003
I tried following steps to run mysql server 5.6 on my windows 8.
I was also having problem with starting MySql server but run command as mention right mark in picture . Its working fine .
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.
mysql -u root -p
After entering this command in terminal, it will ask for password Enter the password and you are ready to go!
You also need to configure and start the MySQL server. This will probably help
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
use the command "mysql -u root -p" in the bin folder path. and give the MY SQL password which you have set earlier.
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?
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.
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 !!
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.
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 connectmaybe
E:\mysql-5.1.39-win32\bin>mysql -u root -p
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
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.
Type
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
to start the sql server and then test the client connection.
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.
Source: Stackoverflow.com