Error No. 2003. Can't connect to mysql server - mysql

I has had two days searching and exploring solutions regarding the error 2003.
Can't connect to mysql server on 'Server name'.
The firewall is off and I had added the port 3306, the one that mysql uses.
Any recommendation?

Please refer this FAQ which describes how to solve this issue: http://faq.webyog.com/content/23/15/en/error-no-2003-can_t-connect.html
Error No. 2003: Can't connect to MySQL server on 'localhost' (or some other host)
simply means that connection is not possible for one of the following (or similar) reasons:
There is no MySQL server running at the specified host
Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
Some networking issue prevents connection. It could be a network malconfiguration or a firewall issue.
When trying to connect to a MySQL server at an ISP this error message often indicates that direct connection to MySQL has been blocked. You must then use HTTP-tunneling or SSH-tunneling to connect.

It worked for me.controll pannel->administrative tools->services->mysql and start mysql.Some times simple solution saves lot of time.

normally means that there is no MySQL server running on the system .
check your server running

this could be due to firewalls of the system try below command and check
service iptables stop

i have the same issue but i fix it.
my hostname is DEBIAN, i just modify the file my.cnf ( for mysql) and set bindaddress : 0.0.0.0
this option say to mysql to listen all interfaces. restart your server and finish

if your question refer to can't connect to mysql on hosting (cpanel), i also had same problem.
I also turn off firewall, but it doesn't solve my problem.
Rather than using server name or domain name on Mysql Host Address, i using ip address given by hosting provider.
And it works.

Going to services and starting MYSQL service doesn't work for me.
Finally, I hit the following commands inside the MYSQL command-line client:
ALTER USER 'username'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

There is a high chance that you are making one of the two mistakes.
First :
You are inputting the wrong password. check your password or change it with
this command
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';
In place of 'very_strong_password' give a strong password of your choice.
Second:
You are using '#' in the password which can be confused with the other with #localhost.

The SQL Sever might not be installed.
Please refer this to install:
MySQL

The solution worked for me
Go to services and start MySql services
window: press the start button and search services. Then star MySql services

Related

How to connect Power BI Desktop to remote MySql server that requires authentication

I have a MySql database running on a remote server which requires ssh authentication that I need to connect to with Microsoft Power BI. I can easily connect to MySQL on my localhost machine, but cannot find a way to manage both the server ssh authentication and the database user log on information.
The server requires authentication on port 22 with a username and password and the MySQL database requires a different username and password.
Can anyone offer assistance?
It seems possible to connect remotely, though I'm not sure you can do it through an 'SSH tunnel' on port 22.
There's a discussion here about connecting remotely which sounds to me like a connection to the usual port 3306, though I'm not certain:
https://community.powerbi.com/t5/Integrations-with-Files-and/Cannot-Connect-to-MySQL-on-Linux-VM/td-p/94914
Some common pitfalls:
1) Make sure you download the correct version of MySQL/Net connector. As of now, version 6.6.5 seems to be working. I wasted a lot of time trying to figure out what was wrong with earlier versions.
2) Server & database settings: closed ports / user permissions / bind-address
Before connecting PowerBI, try to connect another utility like MySQL Workbench. This will force you to troubleshoot the above settings.
This is not currently possible with PowerBI. The feature is currently under review, and you can help get it prioritized by upvoting here:
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/7020353-mysql-over-ssh-connection
I don't think it is supported (yet) but it looks like a lot of people want a solution including me. See this Power BI Ideas Request
1) create gateway to connect server then
2) then it will ask connection string their you can give server port and database username and password
The problem turned out to be an error in the remote servers firewall configuration.
After further research I have confirmed that Power BI would not support dual authentication steps like logging onto a remote server with ssh and then connecting to the database. Thanks Robin for your suggestion. That was a key point.
Please remember that for remote connections you need to authorise the mysql users to connect from specific hosts (adding the IP) or % to allow to get connected from any host remotely
the SQL is something similar to:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
How to allow remote connection to mysql

VB.net - Connect to Database

I got mysql database in the phpmyadmin, and i try to connect to the database from my application.
My connection string is:
Server=12.919.18.12;Port=3306;Database=hbd;Uid=hb;Pwd=123;
An exception occurs:
"Unable to connect to any of the specified MySQL hosts."
Do I need to install mysql or something?
(I just imported MySql.Data.dll and tryied it. Is there anything I have forgotten? I checked the ip pinging my website).
Connection strings for MySQL
is pretty helpful in terms of connection strings. Your connection
string seems to be invalid.
You may check mysql server is working or not and you can add port number of mysql in connection string like this
"Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"
Other reason MySql might be configured to listen to only the local host.
Follow the following links for more information:
Enabling MySQL Remote Access - MySQL connection only works from local machine
Unable to connect to any of the specified MySQL hosts.
IP is invalid 12.919.18.12
Server=12.919.18.12;Port=3306;Database=hbd;Uid=hb;Pwd=123;
IP block is < 256
If the datababase is local, try localhost or 127.0.0.1 as the IP address.
Is the server on your network? If so, the IP is invalid. If I were you, I'd try to check the IP with the person who gave it to you.
the connection string is correct but as ive read a lot of forums they all have the same problems as you do. my solution is that if your trying to create a network base system on a LAN type network you should use XAMPP or WAMPP but i prefer xampp and double check if your accounts or users have an Admin or any other user name for your connection and then see if they have granted all the privileges and with password of course.
Here is the ff instructions:
Open Xammp
Then open a web browser then open 127.0.0.1 or localhost.
click phpmyadmin then at the top click privileges.
add user and make it sure allow all privileges and check all access.
then connect again using the same connection string with the proper user and password.
This issue is RESOLVED :)
try to put the PORT in the end like :
"Server=12.919.18.12;Database=hbd;Uid=hb;Pwd=123;Port:3306;"

Connecting to MySQL from other machines

I have MySQL installed on a Windows 2003 server on our domain. I cannot connect to it from other machines on the domain. I open up the MySQL Administrator panel and try to change the server name from localhost to the machine name it does not recognize it. I have tried fully qualifying the name also. Any ideas what I need to change?
What sort of error, a total inability to connect? Windows Firewall is the first place I'd look, to make sure port 3306 is open.
have you double checked permissions on the databases using something like
grant all priviliges on 'database'.'*' to 'username'#'remote_machine_ip' identified by 'password';
Like Sukasa mentioned, also double check any firewalls you may have configured
You need to look in the my.cnf file and look for the bind-address setting and the skip-networking setting. You want the latter removed or commented out and the former to be the machine's IP address. Restart MySQL after you make changes.
A number of MySQL install packages defaulted to a local socket only install, which is helpful for security but considerably impairs network connectivity. :-)
I was trying to connect to the database using the default root userid. I created a new user and gave this user read permission to the needed tables.

My apps can't connect to mysql, can you suggest things to test?

I'm on a mac server. From my home directory, I can get to mysql on the command line. But apps I install (I've tried phpMyAdmin and then Wordpress) can't connect to mysql#localhost.
Suggestions on troubleshooting the problem?
Also, how can I tell what port mysql is running on?
Try specifying 127.0.0.1:3306 as the host and see if that works...
Edit from comments:
Use netstat -a to check which
port MySQL is listening on.
Check to make sure you have the mysql extension installed.
More information: http://us2.php.net/mysql
Make sure you have explicitly listed localhost when you granted permissions to the user. For example, if you have a database named blog which is accessed by a user named wordpress, you need to create the user with this:
grant all on blog.* to 'wordpress'#'localhost' identified by 'blahblah';
I believe that the mysql command-line utility uses Unix file sockets to connect, which bypasses any hostname or DNS restrictions.

Can't connect to MySQL server on 'localhost' (10061)

I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything worked fine until I got to "Applying Security settings", at which point it gave me the above error (Can't connect to MySQL server on 'localhost' (10061)).
I do have a port 3306 exception in my firewall for 'MySQL Server'.
Got this error on Windows because my mysqld.exe wasn't running.
Ran "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install from the command line to add it to my services, ran services.msc (start -> run), found the MySQL service and started it.
Didn't have to worry about it from there on out.
To resolve this problem:
go to the task manager
select Services tab
find MySql service
Running
That's all.
You'll probably have to grant 'localhost' privileges to on the table to the user. See the 'GRANT' syntax documentation. Here's an example (from some C source).
"GRANT ALL PRIVILEGES ON %s.* TO '%s'#'localhost' IDENTIFIED BY '%s'";
That's the most common access problem with MySQL.
Other than that, you might check that the user you have defined to create your instance has full privileges, else the user cannot grant privileges.
Also, make sure the mysql service is started.
Make sure you don't have a third party firewall or Internet security service turned on.
Beyond that, there's several pages of the MySQL forum devoted to this:
http://forums.mysql.com/read.php?11,9293,9609#msg-9609
Try reading that.
I had difficulty accessing MySQL while connecting via a localhost connection on the standard port 3306, which worked fine when I installed and configured it for prior classes I had taken in MySQL and Java. I was getting errors like "error 2003" and "Cannot connect to MySql server on localhost (10061)". I tried connecting from both MySQL Workbench (5.2.35 CE) and Netbeans (7.2). I am using Windows 7 64 bit professional.
I tried typing in services.msc in the start menu search box, which opened the services dialog box to show all the services installed in windows. I scrolled down to MySQL and started this service. Subsequent attempts to connect to MySQL from MySQL WorkBench and from the command prompt succeeded.
English:
press Windows + R
write "services.msc". Then press Enter
search for MySQL57 and right click
click on start the service
Français :
Appuyez sur la touche Windows + R
Écrire "services.msc" Puis appuyez sur Entrée
Recherchez MySQL57 et clic droit
Cliquez sur rédémarrer
press Windows key + R
write "services.msc" enter
search for "MYSQL56"
write click on it and start the service
Make sure that your windows host file (located at c://windows/system32/drivers/etc.host) has following line. If not, add it at the end
127.0.0.1 localhost
::1 localhost
Sometimes mysql can not trigger Windows to force start host services if firewall blocks it, so start it manually
win+run>>services.msc, select the "MySQL_xx" where "xx" is the name you have assigned to MySQL host services during setup. Click on 'start' to start from hyperlink appeared on left side.
I tried Kuzhichamadam Inn's solution and found that a slight change needed to be made.
MYSQL57 was a network service. I had tried this repeatedly with no success. When I opened services.msc I found another service for localhost: MySQL. I started that one using the process below and it worked.
run > services.msc > rightclick MySQL > properties >start
I got this error when I ran out of space on my drive.
Go to Run type services.msc. Check whether or not MySQL services are running. If not, start it manually. Once it is started, type MySQL Show to test the service.
To connect locally to MySql, you do not have to setup a firewall with inbound rules. But, even if you already setup iptables to allow the TCP inbound port 3306 and grant the privilege to the user to access the db locally, you may have to setup the bind address in your my.cnf file, edit the default address there and put the server IP address that is running the MySql service.
Since I have struggled and found a slightly different answer here it is:
I recently switched the local (intranet) server at my new workplace. Installed a LAMP; Debian, Apache, MySql, PHP. The users at work connect the server by using the hostname, lets call it "intaserv". I set up everything, got it working but could not connect my MySql remotely whatever I did.
I found my answer after endless tries though. You can only have one bind-address and it cannot be hostname, in my case "intranet".
It has to be an IP-address in eg. "bind-address=192.168.0.50".
run > services.msc > rightclick MySQL57 > properties >set start type option to automatic
after restarting computer
At cmd
cd: C:\
C :\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
it will become
C:\Program Files\MySQL\MySQL Server 5.7\bin>
type mysql -u root -p
ie C:\Program Files\MySQL\MySQL Server 5.7\bin> mysql -u root -p
Enter password: ****
That's all
It will result in
mysql>
Another possibility:
There are two ways the MySQL client can connect to the server: over TCP/IP, or using sockets. It's possible you have your MySQL server configured to support socket connections, but not network connections.
Nothing to do just "Reset to Default" your firewall setting it will start working.
I read many solutions but nothing worked properly, so at last I reset firewall settings which worked.
finally solved this.. try running mysql in xammp. The check box of mysql in xammp should be unclicked. then start it. after that you can open now mysql and it will now connect to the localhost
Edit your 'my-default.ini' file (by default it comes with commented properties)as below ie.
basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888
There is very good article present that dictates commands to create user, browse tables etc ie.
http://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1
I did not have Mysql server installed, that package was missing and I got it from this link https://dev.mysql.com/downloads/installer/
Right click on My Computer
Click on Manage
Go to Services and Application
Select Services and find MySQL service
Right click on MySQL and select Start