Some MYSQL CLI tricks/commands

Import full mysql dump on CLI

mysql -uroot -p database_name < /file/path/filename.sql

Import full mysql dump on MYSQL CLI

use database_name;
source /file/path/filename.sql;

View users on MYSQL CLI

SELECT User,Host FROM mysql.user;

Delete an user on MYSQL CLI

DROP USER 'testuser'@'localhost';

Change user password on MYSQL CLI

update user set password=PASSWORD('your_new_password') where User='root';


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.