By javadroid
Hi Digital Oceans, I’ve two ubuntu 16.04 server configured with this tutorial. The first one (Called A) is the MySQL DB server and the second one (Called B) is the Laravel based server. I wanna use server A as DB of server B, So in the server B, I’ve changed the bind-address to 0.0.0.0 and created same DB users on both servers, but when I tried to connect server A with this code:
mysql -h <server-A-IP> -u <user>
I got this error:
ERROR 2003 (HY000): Can't connect to MySQL server on '185.129.169.33' (111)
Could you help me ?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Just comment the bind address on my.cnf file and restart the mysql service.
One thing you can also check to bind your server IP address in my.cnf file and restart mysql services.
Please let me know in it help you.
On the database server, when you create a MySQL User and Database, you need to set the host for the user to that of the connecting server (i.e. the server you’re running your Laravel app on).
For example, on the database sever, to create a user, we’d use:
grant all on dbname.* to 'dbuser'@'LARAVEL_SERVER_IP' identified by 'dbpass';
Where dbname is the database name, dbuser is the database username, dbpass is the database password, and LARAVEL_SERVER_IP is the IP of your server running the Laravel application.
Finally, I just found the result. On the database server, I create two users:
CREATE USER 'dbuser'@'localhost' identified by 'dbpass' ;
and
CREATE USER 'dbuser'@'%' identified by 'dbpass' ;
and then grants all privileges:
GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'localhost' WITH GRANT OPTION;
and
GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'%' WITH GRANT OPTION;
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.