Useful MySQL Commands

Dump DB:mysqldump -u root -p password dbname > dbbackup.sql

Dump DB Structure:

mysqldump -u root -p password –no-data dbname > dbname.sql

Reset MySQL root Password:

*shutdown mysql, then restart as follows-

mysqld_safe –skip-grant-tables –skip-networking &

mysql -u root (no password needed)

mysql> UPDATE mysql.user SET Password=PASSWORD(‘new-password’) WHERE User=’root’;

*Logout, shutdown, and restart normally to login

Useful Debugging Commands:

mysql_get_server_info()

mysql_get_host_info()

mysql_list_dbs()

mysql_list_tables()

mysql_list_fields()

mysql_stat()

mysql_ping()

Advertisements

Comments are closed.

%d bloggers like this: