Using MySQL Workbench in Windows 7 how can I bind my MySQL Server to my IP Address instead of 127.0.0.1 and how can I give users from different hosts access to it?
From here:
Open a DOS command prompt on the server.
Run the following command from the mysql\bin directory:
mysql -u root --password=
A mysql prompt should be displayed.
To create a remote user account with root privileges, run the following commands:
GRANT ALL PRIVILEGES ON . TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';
It depends on hosting server on which the database is hosted e.g. by Hostgator hosting you may bind IPs to access the database remotely, you will have to provide access to user IPs in the hosting. For other like Go Daddy it depends on while creating the database, you will have to select for remote database option which generated a url likewise a host with which database can be accessed with SQLYog/Workbench.
My Answer is you can't bound the IPs with database tools but only with hosting servers.
Related
I've currently set up a staging area for my app in Digital Ocean with LAMP stack. The Framework for my app is Laravel 5.5 and Vue 2x.
In development, I've been using remote MySQL and had no issues with the connection error. However, when I moved it to the staging env, it is giving me access denied error. When I looked at it closely to the error log, Access denied is for username#[digital-ocean-droplet-ip], whereas I have properly configured the MySQL credentials to the remote host IP under laravel's config/database file.
So, I am doubtful if I have to do any configuration under Apache to allow any external MySQL connection? I forgot the cmd but I did allow sfw firewall allow to any port 3306 to the remote server IP address in Apache.
Any help is appreciated.
Thanks!
MySQL by default does not create an user with access from remote connections.
First you need to create an user on database that allows connection from outside (%) or a specific IP
CREATE USER 'newuser'#'%' IDENTIFIED BY 'password';
Than give him privileges
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'%';
The *s could be replaced by your database and table name respectively
You might also check if in your mysql configuration(/etc/mysql/mysql.conf.d/mysqld.cnf in my case) has this line uncommented
bind-address = 127.0.0.1
Change the ip if necessary
restart mysql and apache
sudo service apache2 restart
sudo service mysql restart
Than update the user and password at your .env file and try again!
I've looked in so many areas to try to fix this problem and I can't seem to find a solution. Im running ubuntu linux with the latest mysql and phpmyadmin installation. I found that connecting to the database locally works but if I try to connect remotely it keeps denying the connections. The only way I can login to phpmyadmin is if I put the ip address in the bar, connecting via the web address will not work.
Are you trying to connect to MySQL remotely or PHPMyAdmin remotely?
If you are trying to access MySQL remotely, you need to do the following:
Edit the bind-address variable in /etc/my.cnf, to 0.0.0.0 or the IP address of your server
Make sure your MySQL user has permissions from remote hosts, do this using:
CREATE USER 'myuser'#'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'#'%' IDENTIFIED BY 'mypass';
Then:
GRANT ALL ON . TO 'myuser'#'localhost';
GRANT ALL ON . TO 'myuser'#'%';
Then go ahead and restart the mysql instance on your server. This also assumes you have set IP tables up to allow port 3306 TCP incoming to your server.
I am trying to install drupal on remote mysql server. I have created the user in mysql and granted the the privileges.
I am able to connect through command line from my web server like this "mysql -u xxxx -h 10.xxx.yy.zz3 -p".
But when I tried to install drupal I get "SQLSTATE[28000] [1045] Access denied for user 'xxxx'#'localhost'". I have given the privileges for "xxxx"#"10.xxx.yy.zz3" but drupal appends localhost instead of IP to user name. I have changed settings.php to mysql server IP.
What am I missing?
Instead of editing the settings.php file, try the following:
The third screen during installation (Database configuration) let you set up the database on a remote MySQL server. To do so, expand Advanced options and enter the database host.
I cannot guarantee that this will work, but this is how I set up Drupal to use a remote MySQL server, and I have never had this problem. Btw, I always use the canonical domain name (e.g. mysql.example.org) and not the IP-address.
I have my dev environment set up as a Ubuntu Server (with LAMP installation) inside a vmware. The vmware is running on my local windows 7 machine. When I try to access my mysql server via HeidiSQL program the connection fails. I get a:
Server Error 2003, can't connect to mysql server on <IP ADRESS HERE>
I can however access the db server via PhpMyAdmin. MySQL is running and my connection credentials and port are all correct.
I read that you should enter the IPs of the computer you are trying to connect from as the "bind address" in the my.cnf file. Which I did. I tried both the internal network IP as well as the online IP. Still no luck, same message.
Since this isn't a production environment I would ideally like to allow anyone to access that server, not limit it by IP. Especially since my ISP assigns dynamic IPS. So I would have to change it all the time, assuming that even works.
So does anyone know how I can connect to my MySQL server from a remote computer?
P.S. I assume this is something developers have to deal with that's why I posted it here and not Super User. If it must be migrated please send it to Server Fault not Super User.
Ok, be aware this gives the world and his dog access to your mysql server.
GRANT ALL ON *.* to '%'#'%' WITH GRANT OPTION;
But say you are on your home network of 192.168.1.2/16 then you can at least limit it like this.
GRANT ALL ON *.* to '%'#'192.168.%' WITH GRANT OPTION;
Another option is that you have a user and password but want to connect from anywhere
GRANT ALL ON *.* to 'mysecretuser'#'%' IDENTIFIED BY 'mysecretpassword' WITH GRANT OPTION;
first check the ip assigned to vmware using from cmd
ipconfig/all
suppose ipassigned to vmware is 192.168.11.1
now in vmware in ubuntu check the ipadress
ifconfig
suppose ip adress of ubuntu is 192.168.11.137
now open mysql configurations
sudo nano /etc/mysql/my.cnf
change the bind address to ubuntu ip address
bind-address = 192.168.11.137
restart mysql
now connect to mysql
mysql -u root -p
and create a user with all privileges and host ip of vmware i.e 192.168.11.1
GRANT ALL ON db.* TO user#'192.168.11.1' IDENTIFIED BY 'PASSWORD';
now try to connect from windows.
also open port of mysql
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
restart mysql and try to connect on ubuntu host ip address 192.168.11.137
For Heidi SQL I was able to get it to work following the instructions on this article:
http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html
It uses a program called HTTP Tunnel. It's a lot slower but at least it works. If you use Navicat it comes with a PHP file that you can upload to your server and it will connect via that.
I am trying to connect to a MySQL database server (remote), but I can't. I am using an user with grant privileges (not root user). The error message is the following:
Can't obtain database list from the server.
Access denied for user 'myuser'#'mypcname' (using password: YES)
"myuser" is an user I created with grant access. This user allows me to connect locally to every database. I am using the same software versions in both hosts: MySQL Server 4.1 (server) and EMS SQL Manager 2005 for MySQL, edition 3.7.0.1 (client).
The point is that I need to connect to the remote server using a different user, not root user. So, how to make the connection?
Thanks.
You have to make sure that the remote user account matches what the server will see coming in for a connection. For instance:
grant select on dbname.* to myname#mypc;
will not work if mypc is not resolvable on the server via DNS or the hosts file. In this case, you could try either using an IP, or a FQDN:
grant select on dbname.* to myname#10.1.2.3;
grant select on dbname.* to myname#mypc.example.com;
Look in connectionstrings.com to see if you have the right connection string used for MySql.
Make sure
that your MySQL server listens not only on localhost
your user can access the server from his location. Try 'myuser'#'%' in the GRANT command.
//EMS manager for mysql
//this magnificient tool provide you with a way to connect to such a server that prevents access to the server from any remote file or any way from outside world
//all you need is to have ftp access to the remote server
//in c:/program files/Ems/ you will find file called emsproxy.php
//it is what we call An (API) in programming world
//upload that file to your remote server
//then when you connect with EMS you select tunnling -->checkbox
//it will ask you on the next step to provide a full url of your emsproxy.php
//i tested that process myself. i did not have access to cpanel nieghter phpmyadmin
//thanks