MySQL – How to Create/Assign a User to a Database

Below shows you the syntax required to assign a user (along with password) to a MySQL database. This is useful for assigning separate permissions across your databases rather then just assigning root access across the board. mysql> GRANT ALL ON <DATABASE>.* TO <USERNAME>@localhost IDENTIFIED BY ‘<PASSWORD>’;

How do I Export and Import a MySQL Database ?

There are times during migrations, database restores etc that you will need to export and import your MySQL database. Below shows you the commands required to achieved this. Note : This article is meant as a reference point rather then a full blown article. Export mysqldump -u root -p {database} > db.sql Import mysql -u … Read more

MySQL – How to reset a forgotten Root password

I’m sure that we have all done it. Yep, that’s right you’ve forgotten the MySQL root password. Fear not my fellow conrade, with a few simple simple commands you will be back in control. Stop MySQL First of all stop MySQL. /etc/init.d/mysqld stop Connect to MySQL Next instruct MySQL to ignore the GRANT Tables. Then … Read more

How to clone a MySQL database

 Below shows your the steps needed to clone a MySQL database. mysqladmin create [new db name] -u [username] –password=[password] && \mysqldump -u [username] —password=[password] [old db name] | mysql -u [username] –password=[password] -h [host] [new db name]

Want to become a database expert?

Here is our hand-picked selection of the best courses you can find online:
Ultimate MySQL Bootcamp
Complete SQL Bootcamp
MongoDB Complete Developer course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial