Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have tried pretty much everything I could read on SO. I cannot connect remotely to my sql server. I can't even telnet to the correct port (3306). The connection just hangs. Here is a list of what I've checked/tried:
1) Privileges in mysql
I've run CREATE USER 'test'#'%' IDENTIFIED BY 'pass'; followed by GRANT ALL PRIVILEGES ON db.* TO 'test'#'%';and I flushed the changes.
2) Editing my.cnf
I edited the line bind-addressto be 0.0.0.0. I have made sure that the port is default (3306) and restarted the mysql service.
3) Checked firewall / that the ports are open
Using netstat -tnlp I checked that mysql is listening to port 3306.
To be sure, I turned off the firewall (i assume...?) using sudo ufw disableĀ“, and ufw status` returns "inactive".
HOWEVER Despite all of the above, I still can't connect to my mysql server remotely. I have tried running mysql -u test -p -h xxx but after entering my password the connection just hangs and I get "unable to connect to remote host, connection timed out".
In addition, as mentioned above, I have attempted telnet xxxxx 3306 from another server (where the x's denote the server IP of course), and the connection also just times out/hangs.
If you have anything else for me to try I'd LOVE to hear it.
Thanks in advance
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
When I try to start my docker which has a mysql image, it says the port 3306 is already in use. However, mysql is not even running...
Screenshot of what I've tried : https://i.imgur.com/t7UW1q5.png
My ubuntu server is simply installed from the windows store, pc was restarted, wsl too (I'm running wsl 2). I tried killing the pid 0, but that simply stopped my fluent terminal. I'm not sure what to do anymore since mysql is not running, mysqld neither, no containers are running, nothing...
If anyone knows, I'd really appreciate it.
Thank you very much for the help!
Try this command which should tell you what's reserving the port:
sudo lsof -i -P -n | grep LISTEN
You don't actually have to use 3306 for Mysql, you can modify it with the ports command, for example:
-p 4000:3306
will divert any traffic that is sent to port 4000 to port 3306.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a question for you stackers. I'm not so well renowned with server maintenance and admin configuration. My problem is that I wan't to grant read access for a user to my mySQL databases on a remote server that's hosted by a server company.
I'm connecting via ssh to my server and then trying to create a new user for the databases in root -> mysql.
The problem I'm having is that I cannon't seem to connect to the databases from any other ip than as a localhost on the server itself. The bin-adress in my.cnf is pointing to localhost.
Is there another way to do this? Or rather how do you do this?
I really appreciate your answers.
Log in to your remote server via SSH
Open the the my.cnf file in an editor. (On Ubuntu that is located at
/etc/mysql/my.cnf): sudo vi /etc/mysql/my.cnf
Find the bind-address setting under the [mysqld] section and
change it from localhost to your the public IP address of your
server.
Save your edit.
Restart MySQL: sudo service mysql restart
Grant access to the remote user by logging into mysql as root and executing these commands (obviously you'll need to replace the IP address, database name and remote username with the correct values):
mysql -u root -p mysql
mysql> update db set Host='999.999.999.999' where Db='MyDB';
mysql> update user set Host='999.999.999.999' where user='RemoteUsername';
mysql> exit;
More information can be found on this page.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have the problem of connecting with mysql on my debian server. I run mysql -u root and get the error message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
So I did and I ran the command sudo find / -type s and got
/run/proftpd.sock
/run/mysqld/mysqld.sock
Not /var/run/mysqld/mysqld.sock!
Im simply trying to set up a database server to test it. What should I do?
This question would be better asked on serverfault.com. However, the easiest way to do this (without confusing other Debian apps) would be to create (as root) a symbolic link to the sock file:
# ln -s /run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock
Connect with mysql -u root -S /run/mysqld/mysqld.sock, this should work.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
When I try to connect with putty I get 'host is not allowed to connect to this mysql server'. Why is that happening? Host and client are on my machine.
When I connect with the command line it connects.
You need to change how your configuration is set up.
Comment out the skip-networking section within your MySQL config: # skip-networking, if you have skip-networking it will discard any TCP/IP connection which is likely why your failing.
Once you have enabled your TCP/IP connections you will need to grant permission to your user to connect from other machines:
GRANT ALL PRIVILEGES ON *.* TO <username>#'%' IDENTIFIED BY '<password>';
This will let username connect from any machine to your database with the appropriate password.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a server running a web application that uses a mysql database. The database itself is not located on that server -- it's located on another server. The database server is not accessible from my location.
I'd like to use ssh port mapping so I can run mysql on my Mac laptop and connect to the database. I'm assuming this means I need to connect to my web application server using ssh and port forwarding.
It's like this:
My Mac -> Web Server -> Database Server
I'd like to run the mysql command on my macbook pro something like this:
mysql -u dbuser -hlocalhost -p
and then type in the mysql password.
Also, I connect to my web server using ssh keys.
Add this option to your SSH command line:
-L 127.0.0.1:3306:IP_OF_SQL_SERVER:3306
You will have to use 127.0.0.1 in mysql's -h option ("localhost" means using Unix sockets locally), and you might want to disable compression in SSH, while activating it in mysql client with the -C option.