If you want to change between databases in MariaDB using SSH, it will depend on the user name that you’re using when you’re logged into the command line. The following tutorial will show you how to change the database in command line. Note that some user names may be assigned to multiple databases.
- Login to SSH.
- Login to MySQL (MariaDB) using the database user that you know is assigned to the database you’re trying to view. Use the following command:MariaDB [(none)]> mysql -u username -p
You will notice the following screen if you successfully login. Note that you can see that you’re using MariaDB at this point.
- If you don’t know what databases are assigned to the user that you selected, then you can view the databases that have been assigned to that user..MariaDB [(none)]> show databases;
You will see a list of databases assigned to that user.
- You will need to select the database by using the following command:MariaDB [(none)]> use databasename;
At this point you will be working with the database that you have selected based on the user name you are using. If you want to change databases, you may need to change databases. You can use the exit command to logout. Or if you can use the same user name, you can repeate the use command to select a different database.