SSH Port mapping to access remote database [closed] - mysql

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.

Related

Cannot remotely connect to mysql [closed]

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

Failed to connect to MySql at 127.0.0.1:3306 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
In a new MySQL Workbench; while creating a connection It keeps giving me an error :
" Failed to connect to MySql at 127.0.0.1:3306 ; can't connect to MySql server on '127.0.0.1'(10061)
In my case I had a previous mySQL server installation (with non-standard port), and I re-installed to a different directory & port. Then I got the same issue. To resolve, you click on home + add new connection.
If you need to know the port of your server, you can find it when you start My SQL command line client via All Programs -> MySQL -> MySQL ServerX.Y -> MySQL X.Y Command Line Client and run command status (as below)
There is a difference between 127.0.0.1 and localhost. In all likelyhood your user is setup to access the database on "localhost". If that doesn't work, verify the user you're connecting with can access 127.0.0.1 via the CLI ( IE mysql -uroot -p -h127.0.0.1 ).
Its seams your database ie (mysql) not started,
check the mysql official documentation, how to start mysql server.
If you already install the mysql server follow the below process.
[Your mysql server installation directory location]/bin\mysqld" --install

Which way is the best way to grant read access to a remote database-server? [closed]

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.

MySQL not working after updating to Windows 8.1 [closed]

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
Everything was working fine, I had Windows 8 and MySQL 5.6 workbench.
Yesterday, I upgraded to Windows 8.1 which made the PC run better but messed up the MySQL.
When I enter the workbench I can see my old connection but by clicking on it I get:
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at
127.0.0.1:3306:Can't connect to mysql server on '127.0.0.1'(10061)
Please:
1. Check that mysql is running on server 127.0.0.1
2. Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3. Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
4. Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from the host address you're connecting from.
Well, Uninstalling workbench and re-installing it did the trick.
All Schemas were not deleted
Reinstalling the mysqld service will indeed get the database server to start up again, but you will find that your databases are missing, as are all your user details!
Under Windows 8, MySQL stores its databases under C:\ProgramData\MySQL\MySQL Server 5.5\data while under 8.1 it has all moved to C:\Program Files\MySQL\MySQL Server 5.5\data.
The quick solution to this is:
Stop the mysqld service via MySQL Notifier in the task bar
Copy C:\ProgramData\MySQL\MySQL Server 5.5 to C:\Program Files\MySQL\MySQL Server 5.5
Restart the mysqld service via the Notifier.
Hey presto, your databases and user credentials are back.
After upgrade to Windows 8.1 you either need to run the MySQL config wizard
http://dev.mysql.com/doc/refman/5.1/en/mysql-config-wizard-starting.html
But I could not get that to work, so had to reinstall the MySQL Server.
Then to install it as a service, and point to my earlier databases:
mysqld --install MySQL --defaults-file=C:\MySQL\data\my.ini
Check it's working by running
mysql -u username -p password
show databases;
In my case, the service of mysql was missing. Reinstalling the service with the following command:
mysqld --install [Instance Name] --defaults-file=[My SQL Configuration File]
so, if my install the service, with MySQL is the instance name, and D:\MySQL\my.ini was my previous configuration file, I executed the following command:
mysqld --install MySQL --defaults-file="D:\MySQL\my.ini"
Then start the service as usual. That should do the trick.
Note: You have to execute those command in a command prompt with elevated privilege.

phpMyAdmin not getting started from Linux CentOS? [closed]

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 installed MySQL server on Linux CentOS server with the command -
sudo yum install mysql
I am able to start the Mysqld service. Then I have installed phpMyAdmin with the command
sudo yum install phpmyadmin
I have changed the config.inc.php file for the configuration. Then I have restarted the httpd service. Also I have changed the iptables to give access to mysql port 3306.
But still I am not able to get started phpMyAdmin on the browser.
Also I didnt set the password for root user but when I connect to mysql through command line it asks for the password. I tried with blank password but it is now working.
So please can anybody suggest me how to start phpMyAdmin and get connected to mysql ?
phpMyAdmin is supposed to works flawlessly, I usually installed from the official website after get installed MySQL and PHP. So, have you installed PHP already?
In negative case, you have to do it before run phpMyAdmin.
sudo yum install php5 php5-mysql
It could be that your SELinux is blocking it. I have seen this before with things I have done where SELinux has stopped me accessing it. Running sestatus will tell you.
To disable it, edit the file /etc/selinux/config so SELINUX is set to disabled. Then restart your server and run sestatus to check.