mysql commands

Create a database with name "dbname"

/usr/bin/mysqladmin -u root create dbname -p

Create a user with name "user1" and password "pass1"

CREATE USER user1 IDENTIFIED BY 'pass1'

Grant insert, update and delete permissions on table1 to user1

GRANT INSERT,UPDATE,DELETE ON db1.table1 to user1

Export database to SQL file:

mysqldump -h localhost -u usernam -p dbname > file.sql

Import an exported file to a database:

mysql -u user -p dbname < file.sql
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License