cheat/cheatsheets/mysql

15 lines
475 B
Plaintext
Raw Normal View History

# To connect to a database
mysql -h localhost -u root -p
2013-08-26 16:52:09 +02:00
# To create a database in utf8 charset
CREATE DATABASE owa CHARACTER SET utf8 COLLATE utf8_general_ci;
# To add a user and give rights on the given database
2013-08-27 01:19:52 +02:00
GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'IDENTIFIED BY 'password' WITH GRANT OPTION;
# To backup all databases
mysqldump --all-databases --all-routines -u root -p > ~/fulldump.sql
# To restore all databases
mysql -u root -p < ~/fulldump.sql