All Articles
Data Engineering

MySQL Handy Commands Reference

C
Chandan Kumar
Founder, beCloudReady
February 14, 20241 min read
MySQL Handy Commands Reference

A practical reference of the most useful MySQL commands for developers and database administrators.

Some handy MySQL commands that I have learned over the years

Connect to MySQL server and execute SQL query
mysql -u username -p -h db_name.becloudready.com skucaster -e "SELECT * from forecasting"
MySQL Dump for Regular size DB
mysqldump -h db_name.becloudready.com --user="bcr" -p skucaster > skucaster.sql

If you are getting below error while getting the dump

mysqldump: Got error: 1044: Access denied for user 'bcr'@'%' to database 'skucaster' when using LOCK TABLES
MySQL Dump for Large database
 mysqldump -h db_name.becloudready.com --quick --max_allowed_packet=512M --lock-tables=false --user="bcr" -p skucaster > skucaster.sql
List the processes running in the MySQL server
show processlist;
SHOW STATUS WHERE `variable_name` = 'Threads_connected';

To see a more complete list you can run:

show session status;
status
MySQLDatabaseSQLCommandsReference