Question

WordPress Droplet MySQL Username

Posted January 26, 2021 503 views
UbuntuMySQLLAMP Stack

Hello DO:
I am attempting to connect to The internal MySQL DB I logged in as root
and wordpressmysqlpass=“<some long string>”

I have tried connecting with client DataGrip (JetBrains) using username of *wordpress *and *wordpress_mysql *feel the pwd must be correct because the WordPress droplet is fuctional. But connecting to MySQL is not with either of the usernames.

Is there Some other client tool I should try?

Mark Wardell

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi @markdwardell,

So, the first thing you can always check to learn your user’s password without changing it is your WordPress’s wp-config.php file. In there you can see the database credentials your website is using. Usually, it looks something like this:

/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'wordpress' );

/** MySQL database password */
define( 'DB_PASSWORD', 'PasswordHere' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

And when using a WordPress droplet, you can find the file at the following path - /var/www/html/wp-config.php

Now, if you actually changed the password of your wordpress user, you’ll need to update it in your configuration file as well.

If you want to change the password your wordpress user is using, you can do the following once you’ve SSHed to the droplet:

mysql
 ALTER USER 'wordpress'@'localhost' IDENTIFIED BY 'NEW_PASSWORD_HERE';

Once you do change the password, remember to change it in the wp-config.php file as well.

Regards,
KFSys

Hello, @markdwardell

Would you mind sharing if you’re getting any exact error messages when trying to access the database using the client you’ve mentioned?

Have you tried to access the database using alternative client or simply by using the MySQL client when you’re logged in with ssh on the droplet itself?

You can check this tutorial as well:

How to Connect to a MySQL Server Remotely with MySQL Workbench

Regards,
Alex

by Jon Schwenn
Use MySQL Workbench to connect securely to your remote MySQL database using SSH.