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.

Remote MySQL Question - access denied

Discussion in 'Database Discussions' started by Darkfox, Oct 11, 2015.

  1. Darkfox

    Darkfox Member

    Joined:
    Jun 10, 2015
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sydney Australia
    cPanel Access Level:
    Root Administrator
    We're currently setting up a new cPanel environment for a new project and we're having a slight issue with getting remote mysql working.

    Our cPanel is installed on an EC2 instance with domain cpanel2.example.com, it has a private internal IP address of 10.0.0.2
    Our database is installed on an EC2 instance in the same vpc/subnet, it does not have internet connectivity, however the cpanel server can access it on it's private IP of 10.0.0.3

    # mysql -h 10.0.0.2 -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 1900
    Server version: 5.6.27 MySQL Community Server (GPL)

    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> exit
    Bye
    #

    I tried using 'root'@'10.0.0.2' as the username and it came back with "...access denied for user 'root@10.0.0.2'@'10.0.0.2'...", so I have a fairly good feeling that '-u root' equates to 'root'@'10.0.0.2'

    Anyway.

    I can successfully connect via password authentication from the command line, however when I setup the remote server in cPanel using the following options, I get the access denied error attached;
    upload_2015-10-12_10-28-32.png

    upload_2015-10-12_10-32-28.png

    The user exists in the MySQL User table;
    upload_2015-10-12_10-31-36.png



    If it matters, mysql is installed but not running on the cpanel2.example.com server. I don't know if this matters or not.
     

    Attached Files:

    #1 Darkfox, Oct 11, 2015
    Last edited by a moderator: Oct 12, 2015
  2. Darkfox

    Darkfox Member

    Joined:
    Jun 10, 2015
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sydney Australia
    cPanel Access Level:
    Root Administrator
    I tried to edit the topic to put in my questions, but the forum software wouldn't let me.

    My questions;
    1. Which password is cPanel using to connect to the remote MySQL host? The root shell users password I specified for an SSH connection or the MySQL Root Password specified in WHM?
    2. Is it a requirement to have the local MySQL server running in order to get the remote one working?
    3. If a customer/user utilizes cPanel for a wordpress blog or similar, can they just use "localhost" as the database server when running through their wp-install script?
     
  3. Darkfox

    Darkfox Member

    Joined:
    Jun 10, 2015
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sydney Australia
    cPanel Access Level:
    Root Administrator
    Have found the solution to my particular problem.

    For those that might find this from Google Searches, it's quinessential to have the following file with your root password securely stored in plaintext form:

    $ sudo cat /root/.my.cnf
    [client]
    user=root
    pass=fail

    After adding this file, I was then able to add the remote database.
    I was then able to remotely log into the mysql host;
    mysql -h 10.0.0.3 -u root -p

    then I could do
    show databases;

    and the new database I created showed up

    So this is resolved.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page