Problem with remote access to the MYSQL
Problem with remote access to the MYSQL
Hello,
I have a trouble to remote access to the MySQL.
I have a two server with the VestaCP. In the on of this server in my script i must have remote access to the database (MYSQL)
I tried connected to the host by the IP, by the domain but this still don't work.
I must to add some exceptions on the server connection to work?
The script must connect to the server number two to a database that is located on a server number one. Please help.
I have a standard config of Vesta. System is a Debian 8.6 x64
I have a trouble to remote access to the MySQL.
I have a two server with the VestaCP. In the on of this server in my script i must have remote access to the database (MYSQL)
I tried connected to the host by the IP, by the domain but this still don't work.
I must to add some exceptions on the server connection to work?
The script must connect to the server number two to a database that is located on a server number one. Please help.
I have a standard config of Vesta. System is a Debian 8.6 x64
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Problem with remote access to the MYSQL
you need to make sure your MySQL is listening on port 3306 and your Public IP, by default Mysql is listening to unix socket (localhost). Also ensure port 3306 is not blocked in your firewall.
Once you get it working, if possible only allow certain IP or IP range to be able to connect to MySQL on TCP port remotely. This will make it more secure.
Once you get it working, if possible only allow certain IP or IP range to be able to connect to MySQL on TCP port remotely. This will make it more secure.
Re: Problem with remote access to the MYSQL
Thanks for the reply.mehargags wrote:you need to make sure your MySQL is listening on port 3306 and your Public IP, by default Mysql is listening to unix socket (localhost). Also ensure port 3306 is not blocked in your firewall.
Once you get it working, if possible only allow certain IP or IP range to be able to connect to MySQL on TCP port remotely. This will make it more secure.
MySQL is able to connect on TCP Port 5342 and 3306. Ping to mysql server is okay
Re: Problem with remote access to the MYSQL
In the additional.
I can't connect to the my configuration script to the database on server number one with the VestaCP. I must add anything to the connect? Host is a IP of server.
I can't connect to the my configuration script to the database on server number one with the VestaCP. I must add anything to the connect? Host is a IP of server.
Re: Problem with remote access to the MYSQL
I try connect by the SSH to the mySQL and i have :
root@ns325037:~# mysql -h here_is_my_ip -u database_name -p
Enter password:
ERROR 1045 (28000): Access denied for user 'here_is_username' (using password: YES)
root@ns325037:~#
In vesta CP firewall i have the accept TCP from the 3306 and 5432. I must add something new?
root@ns325037:~# mysql -h here_is_my_ip -u database_name -p
Enter password:
ERROR 1045 (28000): Access denied for user 'here_is_username' (using password: YES)
root@ns325037:~#
In vesta CP firewall i have the accept TCP from the 3306 and 5432. I must add something new?
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Problem with remote access to the MYSQL
You don't have the user created on the host MySQL with which you are trying to connect from your guest script.
Re: Problem with remote access to the MYSQL
# Change MySQL root password
v-change-database-host-password mysql localhost root New*Password
# Run MySQL
mysql -uroot -pNew*Password
# Give root user remote access privileges from any host
GRANT ALL PRIVILEGES ON *.* to 'root'@'%' identified by 'New*Password' WITH GRANT OPTION;FLUSH PRIVILEGES;
# Exit from MySQL
quit
# Restart MySQL
service mysql restart
# Try again to remote connect to your MySQL server
v-change-database-host-password mysql localhost root New*Password
# Run MySQL
mysql -uroot -pNew*Password
# Give root user remote access privileges from any host
GRANT ALL PRIVILEGES ON *.* to 'root'@'%' identified by 'New*Password' WITH GRANT OPTION;FLUSH PRIVILEGES;
# Exit from MySQL
quit
# Restart MySQL
service mysql restart
# Try again to remote connect to your MySQL server