Back to Blog
Connect mysql ssh7/2/2023 No you can log in to your mysql server hosted at ip address 172.16.0.20 Note that this user won't work on the localhost as I did not include a It gives the "office_user" user nearly complete access to all databases on the MySQL server.ĬREATE USER IDENTIFIED BY 'office_pass' Use this only when you are doing simple testing and on a non production server. This is the quick and insecure way of creating a user at the office that can do any thing on the MySQL database from any of the networks. I need to grant statement that will let me use the mysql client on there machine at the office to connect to what ever database I give it access to. Have a look at the grant and create user statements.Īt our office, if I create a database on machine A and I want every body on the network 172.16.0.1/24 or 192.168.0.1/24 to be able to access that machine if they know the user name "office_user" and password "office_pass". Maybe you don't need to ssh into the machine at all, all you need to do is let MySQL know that clients from your network are allowed access to that machine. Oh, fwiw, if I use the first command, then the mysql command fails with the message ERROR 1130 (HY000): Host 'compt_A' is not allowed to connect to this MySQL server The reason it doesn't make sense to me is because the first command says, "establish an SSH tunnel over port 2200, forwarding local port 3307 to port 3306 on computer B" and that makes more sense than, "establish an SSH tunnel over port 2200, forwarding local port 3307 to port 3306 on 127.0.0.1" I was using the following command to make a tunnel ~$ssh -p 2200 -L 3307:compt_B:3306 cat. I figured out a solution, but I don't understand why. I just don't know how.Īnswering my own question (because I can't answer in less than 8 hours) Here is the interesting thing - I have another gui program called Sequel Pro (a desktop MySQL client for Mac OS X), and that is able to make a connection to over ssh just fine. However, the following fails (in another terminal A~ $ mysql -P 3307 -u punkish -pĮRROR 1045 (28000): Access denied for user (using password: YES) I am not sure if the tunnel is established, but I am assuming it is. This will allow me to use a gui program (Quantum GIS) that wants to connect to mysql, but can't do it over a tunnel. However, I want to set up port forwarding over ssh on my computer so all requests made for mysql on port 3307 on my computer A are actually sent to port 3306 on B. I can ssh into B over port 2200 with ssh key pairs set up, and once in, I can connect to the db like so A~ $ ssh -p 2200 $ mysql -u punkish -p database I have access to computer B that also has mysql running on it. I am on computer A, and have mysql running on it, and can connect to it as A~ $ mysql -u punkish -p database and so on. All the computers involved are Mac OS X 10.6.x machines.
0 Comments
Read More
Leave a Reply. |