Connect to Database as Root

  • Answered
I have obtained root access and I can SSH into the sever as the root but how can I connect to the Database as the root remotely with either PHP or MySQL Workbench?
Hello stsIT, Thank you for submitting a question regarding connecting to MySQL. With PHP, the connection will be in the actual php code, and it is recommended to use the MySQLi extension. And, this would be connecting as root, which would be a security hazard. For PHP, you will want to make a dedicated database user with privileged access, only on the localhost, to one of the databases. We also have a full guide on how you can connect to a database with MySQL workbench. The settings are included in that article, and you can use your cPanel username or a database user you created. Best, Christopher M.