How to access MySQL/MariaDB from terminal server
A lot of people ask me about faster access and consult.
# Login with client and password
$ mysql -u username -p
# List all databases in MySQL:
mysql> SHOW DATABASES;
+ — — — — — — — — — — +
| Database |
+ — — — — — — — — — — +
| my_project |
| information_schema |
| mysql |
| performance_schema |
| sys |
+ — — — — — — — — — — +
# Use the database ‘my_project’ for all later commands
mysql> use my_project;
# List all tables in db ‘my_project’
mysql> show tables;
# Show the schema of ‘table_name’ within ‘my_project’
mysql> describe table_name;
# Consult
mysql> select * from table_name where 1
Very simple, right?!