Mysql Database 数据迁移
2018-10-10 14:32
453 查看
[root@amb01 ~]# mysql -uroot -pabcd.1234 mysql> show variables like '%secure%'; +------------------+---------------------+ | Variable_name | Value | +------------------+---------------------+ | secure_auth | ON | | secure_file_priv | /home/mysql/backup/ | +------------------+---------------------+ 2 rows in set (0.00 sec) mysql> use tpcc1000 Database changed mysql> select * from customer into outfile '/home/mysql/backup/customer.txt' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n'; Query OK, 300000 rows affected (2.47 sec) mysql> select count(*) from customer; +----------+ | count(*) | +----------+ | 300000 | +----------+ 1 row in set (0.11 sec) mysql> set foreign_key_checks=0; Query OK, 0 rows affected (0.00 sec) mysql> truncate table customer; Query OK, 0 rows affected (0.19 sec) mysql> select count(*) from customer; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (0.00 sec) mysql> load data infile '/home/mysql/backup/customer.txt' into table customer fields terminated by ',' optionally enclosed by '"' lines terminated by '\n'; Query OK, 300000 rows affected (9.12 sec) Records: 300000 Deleted: 0 Skipped: 0 Warnings: 0 mysql> set foreign_key_checks=1; Query OK, 0 rows affected (0.00 sec) mysql> select count(*) from customer; +----------+ | count(*) | +----------+ | 300000 | +----------+ 1 row in set (0.06 sec)
mysql> set @@global.foreign_key_checks = 0; Query OK, 0 rows affected (0.00 sec) mysql> select @@global.foreign_key_checks; +-----------------------------+ | @@global.foreign_key_checks | +-----------------------------+ | 0 | +-----------------------------+ 1 row in set (0.00 sec) mysql> truncate table customer; Query OK, 0 rows affected (0.38 sec) mysql> select count(*) from customer; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (0.00 sec) [root@amb01 ~]# mysqlimport -uroot -pabcd.1234 tpcc1000 -d --fields-terminated-by=',' --fields-optionally-enclosed-by='"' --lines-terminated-by='\n' /home/mysql/backup/customer.txt Warning: Using a password on the command line interface can be insecure. tpcc1000.customer: Records: 300000 Deleted: 0 Skipped: 0 Warnings: 0 [root@amb01 ~]# mysql -uroot -pabcd.1234 mysql> set @@global.foreign_key_checks = 1; Query OK, 0 rows affected (0.00 sec) mysql> select @@global.foreign_key_checks; +----------------------------- 5b4 + | @@global.foreign_key_checks | +-----------------------------+ | 1 | +-----------------------------+ 1 row in set (0.00 sec) mysql> use tpcc1000 Database changed mysql> select count(*) from customer; +----------+ | count(*) | +----------+ | 300000 | +----------+ 1 row in set (0.06 sec)
相关文章推荐
- Spring Batch Example – CSV File To MySQL Database (四)
- Mysql 数据迁移
- Mysql entity database first模式不支持entity framework6
- mysql 数据迁移(主从同步)
- 远程连接Hostinger MySQL数据库 setup remote MySQL Workbench connection to Hostinger MySQL database
- 彻底删除mysql 分类: database 2013-09-11 11:21 584人阅读 评论(0) 收藏
- 关于MYSQL DATABASE相关操作与介绍
- sqoop基础之MySQL与 hive之间的数据迁移
- error while performing database login with the mysql driver 的解决方法
- MySQL_Database_Show_Create_Drop
- MySQL Cannot Connect to Database Server
- MySQL自带的database
- Nginx + PHP mysql_pconnect = Database errors (Too many connections)
- Ubuntu下彻底卸载mysql、安装mysql、及MySQLdb模块 分类: ubuntu 问题总结 database 2014-01-23 13:49 2560人阅读 评论(0) 收藏
- 关于mysql 数据库没有 mysql库 和重启mysql后密码无法登陆 Access denied for user ''@'localhost' to database 'mysql'
- Qt5.4下连接Mysql,QSqlDatabase: QMYSQL driver not loaded but available
- backup mysql database and ftp to another computer
- MyEclipse中连接mysql数据库提示error while performing database login with the testMySQL driver check your url
- 安装配置解压缩版或非安装版MySQL Database Server
- MySQL: 1006 - Can't create database '***' (errno: 13) 错误 解决方法