I need to access my MariaDB installation from another PC on my local network but get the following error:
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.127' (111)
I know this is because it's bound to localhost but I can't seem to find the relevant config file. I have tried several but it looks like this:
/etc/mysql/mariadb.conf.d/50-server.cnf
is the only one with settings in it but after restarting I still cannot access. As a test I temporarily changed the port to 3305 from 3306 and running lsof -i -P | grep :3306 still showed mysql running on 3306 so I know the settings are not taking.
Where is the config file or am I missing something?
I just figured out what was wrong:
/etc/mysql/mariadb.conf.d/50-server.cnf
Is the correct file but for some reason
service mysql restart
Didn't take so I tried rebooting and it's fixed! Hope this helps someone..
Related
No matter what I try i keep getting this error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061).
This goes for: 1) >mysql 2) >mysql -u root 3) >mysql -u root -p 4) >mysqlshow etc....
Mysql version: 8.0.12.0
OS: Windows 10
So the suggested solution I keep encountering is to enable the mysql service manually, but the mysql80 service is running no problem and the port 3307 (i tried both the default 3306 and 3307) show up in netstat as:
TCP 0.0.0.0:3307 0.0.0.0:0 LISTENING
I don't see anything wrong in my my.ini file either (skip-=networking= is commented out and there is no bind-address line), but just in case here is a link: https://drive.google.com/file/d/1udfXwvl-W7UI3pCissTTBYD0wNnDTBiT/view?usp=sharing.
mysqld -u root --skip-grant-tables
Doesn't do anything at all, no error messages either.
I disabled firewall as well but still no luck.
I've been looking for a solution for days on end now so any help is much appreciated.
EDIT: to clarify I cannot access the sql shell via the command line, because this also gives me ERROR 2003
After stopping firewall restart system and check. Run the cmd as Administrator and check. Please paste the error log for more clarity.
Okay so i finally got it to work, I don't know where the issue was but this is what I did:
1) stop the mysql80 service and delete it with Sc delete MySQ in the cmd
2) Go to Add or remove programs and uninstall anything mysql related
3) remove the mysql folders in Program files, programData and C:\Users\username\AppData\Roaming
4) download sql community installer and when asked if you want to download the latest installer DON'T download it, just use the current one. Previous clean re-installs didn't work until I stopped using this newer installer version.
5) Reinstall everything as before
6) SUCCES!
I'm trying to connect on my mysql database when I'm not on localhost - on localhost it's working. Everytime I wish to connect, I don't have any error, but only a timeout exec...
Here is what I've done so far
create a user on mysql who can access to any hosts("%")
purge the iptables
my port 3306 is opened (see screenshot)
the bind-address line is 0.0.0.0 in the mysqld.cnf file - I even tried to put in it comment - please note my.cnf sends to the mysqld.cnf file.
of course for every modification I've restarted the mysql server - and the server itself...
no firewall are setup...
I'm on Ubuntu 16.04 LTS, mysql and phpmyadmin are setup on it.
What I'm missing ?
Thank you for your help
Bastien
After you changed the bind address you restarted with systemctl restart mysql.service, yes?
Here's a very similar situation, try following all of these steps: Remote Connections Mysql Ubuntu
I think the flush privileges step will be a help to you.
I recently upgraded my Mac Pro to a Mac Mini and used the migration assistant to transfer all my files and applications across to the Mac Mini.
I also re-installed macports and configured apache etc. So I've managed to get my localhost and php working on the new machine.
However I am now unable to start mysql from terminal?
When I try my usual:
mysql5 -u root -p;
and got the following error:
Error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
I've also tried restarting mysql:
sudo opt/local/share/mysql5/mysql/mysql.server restart
and got the following error:
ERROR! Manager of pid-file quit without updating file.
When I navigate to my mysql5 directory /opt/local/var/db/mysql5/ I see a list of my databases, and see the following PID files:
myName.local.pid
and
localhost pid
So the structure is similar to what was on my old Mac but I confused as to what is causing mysql to not start?
Interestingly, mysql must be still working because when I run an .php scripts in my browser the mysql queries work and the data is being retrieved.
Any help much appreciated.
SOLVED
I would like to share the solution that I came across to resolve this issue.
When you update to El Capitan from a previous version of OSX your mysql settings get lost. When you try to connect via:
mysql5 -u root -p;
I was getting the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
The problem was with my.cnf!
The default configuration of macports mysql does not come with a my.cnf (it does however have others my-medium.cnf, my-small.cnf) so the Macports mysql client is going to look where the Macports server is set to look.
I also learned that if you've changed the socket path away from the default then you need to tell everything where it is. Most programs have a hard coded default that can be overridden, I had overridden the macports default to the one php is compiled to, so you need to tell the client what you've changed it to otherwise how is it supposed to know.
Because I did not have a copy of my.cnf in opt/local/share/mysql5/mysql, the client did not know where to look for the socket. So I had to define the path to the socket in the my.cnf for both the [client] and [mysqld] configurations.
The in my case the path to the socket should have been:
socket = /opt/local/var/run/mysql5/mysqld.sock
I then restarted mysql:
sudo /opt/local/share/mysql5/mysql/mysql.server restart
And SUCCESS at last.
Hope this helps.
I'm trying to install Concrete5 on a localhost using MAMP, but every time I put it the database information, I get this error.
SQLSTATE[HY000] [2002] No such file or directory
How can I solve this problem?
Error 2002 is typically displayed as
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/mysqld/mysqld.sock'
PHP can't connect to MySQL using a socket. On windows you probably don't want to use unix socket.
"But I'm not using unix sockets, I'm simply connecting to localhost" you might say.
For the PHP driver 'localhost' has a special meaning as described in the PHP manual.
The hostname localhost has a special meaning. It is bound to the use of Unix domain sockets. It is not possible to open a TCP/IP connection using the hostname localhost you must use 127.0.0.1 instead.
Solution: configure 127.0.0.1 as your MySQL host for Concrete5.
I finally solved this problem. I went into MAMP and found the MySQL port number and typed into the server box in this format: localhost:[MySQL Port].
Try 127.0.0.1:[MySQL port], that did the trick for me.
To find your port number, go to the MySQL section in MAMP and look at the top right corner of the screen. There will be a message saying: MySQL is configured to use port [port number].
I did it on MacOS 10.13 and MAMP 5.1, create a symlink to mysql.sock in /var/mysql (create the directory if it does not exist).
It's solution works global, without change any config, so PHP can connect to MySQL.
Type it in console/terminal:
sudo mkdir /var/mysql
cd /var/mysql && sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock
I've been attempting pretty much all day to get Symfony2's Doctrine configuration screen (e.g. /app_dev.php/_configurator/step/0) to connect to my locally running MAMP-provided MySQL instance. I've spent the day reading about sockets, skip-networking, and every other possible scenario but I'm at a loss. This is the error that you have most certainly seen before:
An exception occured in driver: SQLSTATE[HY000] [2003] Can't connect to MySQL
server on '127.0.0.1' (61)
And here are the various ways I have tried to correct this maddening problem:
I verified that I can indeed connect on the command line to both localhost and 127.0.0.1 using the mysql command. I made sure the ports were both filled in and not so I could see the results of an actual error.
I checked the socket while I was in there via SHOW variables LIKE 'socket' and saw it pointed correctly to my MAMP socket.
I've oscillated between the MAMP default ports and the standard MySQL ports (3306) just in case it was a weird port thing.
I made sure my /var/mysql and /tmp/mysql mysql.sock files were correctly symlinked to MAMP.
I commented out the skip-networking lines in MAMP's configuration file.
I toggled the "Allow Network Access" in every configuration possible
I added the line, unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock, to my config.yml file just in case my symlinking trickery failed me.
I've done several rain dances and other tribal spells I read in a magazine trying to get this to connect.
I'm no stranger to development and MySQL but this has become a lost cause. Any help would be appreciated and rewarded with my unflinching respect for you.
The error code 2003 means "Can't connect to MySQL server", you can try to use the following methods.
Check your config file, is the parameters.yml can be access ? If you are on linux, just sudo chmod 777 /path/to/parameters.yml, and the mysql connection config parameters looks like this:
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1 or localhost
database_port: null
database_name: yourdbname
database_user: youraccount
database_password: yourpassword
Try to use localhost instead of 127.0.0.1;