Skip to main content

Can't connect to MySQL database PHP7

Comments

7 comments

  • cPanelLauren
    PASSWORDFORUSERACCOUNTHIDDEN is the password that is set to the user account 'warbi260_warbi26'

    That's also the password you've set for the user in the MySQL Databases section of cPanel? Can you also access the MySQL command line interface with that user and password?
    0
  • warbi2601
    That's also the password you've set for the user in the MySQL Databases section of cPanel? Can you also access the MySQL command line interface with that user and password?

    Thank you for the reply, I have been looking for it for a while but I cant find a way of getting onto a MySQL command line through CPanel? Can you point me in the right direction please?
    0
  • nixuser
    Thank you for the reply, I have been looking for it for a while but I cant find a way of getting onto a MySQL command line through CPanel? Can you point me in the right direction please?

    Do you have root access on this server?
    0
  • cPanelLauren
    You shouldn't need root access to the server to access the mysql command line. Your user does need to have shell access. You can use the terminal feature if available within cPanel or your can access using ssh. Once logged into the server at the command prompt you would just type: mysql -u $user -p
    You'll be prompted for the user's password, if correct you should be in the MySQL commandline interface when complete and receive a message similar to the following: [myuser@server ~]$ mysql -u mydbuser -p Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 765 Server version: 10.3.16-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mydbuser]>
    0
  • warbi2601
    You shouldn't need root access to the server to access the mysql command line. Your user does need to have shell access. You can use the terminal feature if available within cPanel or your can access using ssh. Once logged into the server at the command prompt you would just type: mysql -u $user -p
    You'll be prompted for the user's password, if correct you should be in the MySQL commandline interface when complete and receive a message similar to the following: [myuser@server ~]$ mysql -u mydbuser -p Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 765 Server version: 10.3.16-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mydbuser]>

    Hi Lauren, Thanks again for the reply and apologies for the delay. I tried connecting via SSH but can't get it to work. I tried following the cPanel documentation and a cPanel youtube video but ended up with the same "Connection timed out" error. I even tried downloading puTTy but that is giving me a similar error message. Apologies again I'm new to this! 59931 59927 59935
    0
  • nixuser
    Are you sure that ssh service is running on port 22? Please contact your hosting provider and ask whether you have shell access and confirm the ssh port number.
    0
  • cPanelLauren
    Do you have the terminal feature available in your cPanel account? If you did it would be present at /var/cpanel/terminal Otherwise, to further troubleshoot the MySQL issue as well as shell access I'd suggest contacting your provider.
    0

Please sign in to leave a comment.