Command line usefull command

Command line usefull command.

Last updated:

Warning: Review and test in a non-production environment before running.

Back to results

Display a list of existsing databases:                               SHOW DATABASES; 
Drop a database                      :                                      DROP DATABASE dbname;
Enter to a specific database         :                                 USE dbname;
display tables                       :                                          SHOW TABLES;
describe the table structure         :                                   DESC tablename;
Display all indexes of a table       :                                   SHOW INDEX FROM table_name\G
Execute sql file                     :                                          mysql>source c:\....\....\sqlfile.sql
Import a database from file          :                                  mysql>mysql -u root -p password database name < c:\....\....\dbfile.sql
Export a database to file            :                                    mysql>mysqldump -u root -p password database name > c:\....\....\dbfile.sql