Connecting to external MySQL db: "ERROR 1045 (28000): Access denied for user"

qtriangle

Registered
May 15, 2014
4
0
1
cPanel Access Level
Root Administrator
I have a website which is hosted on cpanel, and uses and external mysql server.
When the script tries to connect to the external server, following error is generated:

ERROR 1045 (28000): Access denied for user

Same error is shown when I connect to external db from shell, from the server having the website and cpanel.

However, I am able to connect to the external DB from a third server using shell. It means something on the cpanel server stops external mysql connctions.

May I know how to solve this?

PS: This is not "allowing remote connections for mysql database on cpanel server", but opposite of it.
 

sktest123

Well-Known Member
Jan 31, 2017
99
6
8
kochin
cPanel Access Level
Root Administrator
Seems you have mysql remote server settings all ok in cpanel server , it might be privileges issue in remote server.

In remote mysql server, run
mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'1.2.3.4' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
Replace it with needed db (db name), user and ip ,passwd
Then flush privileges
 

qtriangle

Registered
May 15, 2014
4
0
1
cPanel Access Level
Root Administrator
Seems you have mysql remote server settings all ok in cpanel server , it might be privileges issue in remote server.

In remote mysql server, run
mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'1.2.3.4' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
Replace it with needed db (db name), user and ip ,passwd
Then flush privileges
That's not the case. I have allowed connections for [email protected]*, and I had already mentioned:

However, I am able to connect to the external DB from a third server using shell. It means something on the cpanel server stops external mysql connctions.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Hello,

Do you have any firewall rules restricting outgoing traffic over port 3306? What rules exist in your system's /etc/my.cnf file?

Thank you.
 

qtriangle

Registered
May 15, 2014
4
0
1
cPanel Access Level
Root Administrator
Hello,

Do you have any firewall rules restricting outgoing traffic over port 3306? What rules exist in your system's /etc/my.cnf file?

Thank you.
I have csf with status: "Firewall Status: Disabled and Stopped"

my.cnf has following values:
Code:
[mysqld]
innodb_file_per_table=1
default-storage-engine=MyISAM
performance-schema=0
max_allowed_packet=268435456
open_files_limit=10000

query_cache_size=64M
query_cache_limit=1M
join_buffer_size=8M
sort_buffer_size = 8M
read_buffer_size = 8M

read_rnd_buffer_size = 4M
max_heap_table_size = 50M
innodb_buffer_pool_size = 1G
table_open_cache = 4000
key_buffer_size = 128M
tmp_table_size = 128M
myisam_sort_buffer_size = 64M
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.