MySQL command help

Command to create mysql user

CREATE USER 'username'@'localhost' IDENTIFIED by 'password';

Command to grant all privileges to a user to databases starting with any name

GRANT ALL PRIVILEGES ON database_.* TO 'username'@'localhost' IDENTIFIED BY 'password';

flush privileges;

The above two line command will make the user “username” to have all the privileges to add delete modify databases that starts with the name database_.

Command to dump mysql database

mysqldump -u [databaseusername] -p[password] databasename > databasebackup.sql

Command to restore mysql database

mysqldump -u [databaseusername] -p[password] databasebackup < databasename.sql

Command to dump all MySQL databases

mysqldump -u root -p(password) –all-databases > dumpfilename.sql

Command to grant privileges to mysql database starting with prefix

 GRANT ALL PRIVILEGES ON `databaseprefix_%`.* TO 'username'@'localhost'; 

One comment

  1. Long Hairstyles says:

    hello there and thank you for your info ?I?e certainly picked up something new from right here. I did however expertise several technical issues using this website, since I experienced to reload the website many times previous to I could get it to load correctly. I had been wondering if your web host is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement in google and can damage your high quality score if advertising and marketing with Adwords. Anyway I? adding this RSS to my email and can look out for much more of your respective exciting content. Make sure you update this again very soon..

Leave a Reply

Protected by WP Anti Spam