Question
Not sure what to do when in the console to access the database.
New to this, I’m trying to set up a wordpress site, I have the droplet made, and I think everything set up for it, but on the wordpress installation when everything was done I think I changed the site address url, causing an issue of the page not existing anymore.
I know how to change it, (I think) but I need to access the database. I’m actually not exactly sure what to do when I get there.
I was also told to use phpmyadmin, but again not exactly sure how to use that in conjuction with this droplet.
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.
×
Hi!
To access the database via command line (you’re using MySQL, right?), just type the following:
mysql -h localhost -u YOUR_USER YOUR_DATABASE -p
Where:
-h: your host (if you are not using localhost, just replace it with the address/IP of your MySQL server)
-u: your database username
-p: tells MySQL that you want to log in using a password
And press
enter
, so you’ll be prompted to input your database password.If everything is ok, you’ll see something like:
mysql >
Here you can input your queries (SELECT, INSERT, SHOW TABLES, etc) normally.
To install/use PHPMyAdmin, you can simply follow this cool tutorial:
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-14-04