建立資料庫
/usr/bin/mysqladmin -u root -p123456 create sfs3
還原資料庫
/usr/bin/mysql -u root -p123456 sfs3 < /ok/sfs3.sql
備份資料庫
/usr/bin/mysqldump -u root -p123456 sfs3 > /ok/sfs3.sql
刪除資料庫
/usr/bin/mysqladmin -u root -p123456 drop sfs3


依日期來備份資料庫
/usr/bin/mysqldump -u root -p123456 sfs3 > /ok/sfs3-$(date +%Y-%m-%d).sql

備份資料庫中的資料表
/usr/bin/mysqldump -u root -p123456 phpbb2 phpbb_users > /ok/phpbb_users.sql

還原資料庫中的資料表
/usr/bin/mysql -u root -p123456 phpbb2 < /ok/phpbb_users.sql


[root@RHEL3 RHEL]# /usr/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 8 to server version: 3.23.58

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> exit
Bye
[root@RHEL3 RHEL]# /usr/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 9 to server version: 3.23.58

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET password=password('654321') where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>exit

arrow
arrow
    全站熱搜

    kevin0523 發表在 痞客邦 留言(0) 人氣()