How can I know my database informations?

April 6, 2015 890 views


I searched this all day long and I couldn't find anything on phpmyadmin or webmin.

I'm searching;

$dbhost = "";
$dbuser = "";
$dbpass = "";
$dbname = "t";
$display_errors = false;

these informations.

I'm new on vps so please help me.

  • What type of droplet did you create? If you created a PHPMyAdmin server you can find the mysql root password in the MOTD displayed when you log in via ssh. In that case the settings would be:

    $dbhost="localhost" (assuming that the web app is running on the same server as your database)
    $dbpass="Password displayed in MOTD
    $dbname="name of the database you created"

  • My droplet: 512MB Ram 20GB SSD Disk Amsterdam 3 Ubuntu 14.04 x64
    I created phpmyadmin server in droplet but I never created a ssh password because I didn't know it's necessary for dbpass. And I don't know what is motd. What should I do in that case now?

1 Answer

If you installed phpmyadmin using apt-get then your mySQL Server should be installed with the user root and no password.

If you installed manually by downloading the phpmyadmin files and installed on a web server you will need to install mySQL.

apt-get install mysql-server

then run

/etc/init.d/mysql start

this will start your mySQL Server. Your connection details will be

User : root
Password : <blank>
Hostname: localhost
Port : 3306

You can create a database by running

mysqladmin create <dbname>

Once you have done this your config should look like this

$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "<dbname from above>";
$display_errors = false;

I highly recommend you set a root password on mySQL however and never run queries as root unless creating new databases or adding users.

Have another answer? Share your knowledge.