第一
mysql -uroot -p123123 -h127.0.0.1 < /data/workspace/myshixun/src/data.sql
mysqldump -u root -p studb student> /student_bk.sql
mysql -uroot -p123123 -h127.0.0.1 -e "create database studb2;"
mysql -u root -p123123 studb2 < /student_bk.sql
第二
chmod 777 /
vim /etc/mysql/my.cnf -->
[mysqld]
secure-file-priv="/"
service mysql restart
mysql -u root -p123123 studb2
SELECT * FROM studb.student INTO OUTFILE "/student_out.txt" LINES TERMINATED BY "\n";
第三
vim /etc/mysql/my.cnf -->
[mysqld]
log-bin=/binlog.log
service mysql restart
mysql -u root -p123123 --> FLUSH LOGS;
第四
mysql -u root -p123123 -->
USE studb
CREATE TABLE member
(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50));
INSERT INTO member VALUES(NULL, 'Playboy1');
INSERT INTO member VALUES(NULL, 'Playboy2');
SET SQL_LOG_BIN=0; /*暂停二进制日志功能*/
drop table member; /*删除数据表*/
SELECT * FROM member;
SET SQL_LOG_BIN=1; /*打开二进制日志功能*/
mysqlbinlog /binlog.0000001 | mysql -uroot -p123123 /*还原数据表*/
mysql -u root -p123123 -->
USE studb
SELECT * FROM member;