Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Database Discussions' started by qtriangle, Feb 26, 2017.

  1. qtriangle

    qtriangle Registered

    Joined:
    May 15, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    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.
     
  2. sktest123

    sktest123 Well-Known Member

    Joined:
    Jan 31, 2017
    Messages:
    76
    Likes Received:
    5
    Trophy Points:
    8
    Location:
    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
     
  3. qtriangle

    qtriangle Registered

    Joined:
    May 15, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    That's not the case. I have allowed connections for user@*, 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.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    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.
     
  5. qtriangle

    qtriangle Registered

    Joined:
    May 15, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    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
    
    
    
    
     
    #5 qtriangle, Feb 27, 2017
    Last edited by a moderator: Feb 28, 2017
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page