28 août 2014

Mysql

1 Remove constraint key

Set foreign\_key\_checks=off;

2 connect to the database

mysql -u user -p database

3 Liste des tables:

show tables;

4 clear database

mysql -u user -p database -e "show tables" | grep -v Tables\_in | grep
-v "+" | gawk '{print "DROP table " $1 ";"}' > temp\_sql

5 See user rights

show grants; or SHOW GRANTS FOR CURRENT\_USER;

6 Create database

CREATE DATABASE dbname;

7 Grant all provileges

grant all privileges on /./ to FOO@localhost identified by 'f00'; grant
all privileges on dbname.* to FOO@localhost identified by 'f00';

8 grant super privileges

GRANT SUPER on /./ to 'FOO'@'localhost';

9 Create a dump

mysqldump -u user -p data > database\_20090428.dmp
Tags: logiciel
Other posts