aliyun.CentOS7.MySQL操作.2017-09-27

初始化MySQL数据库

MySQL数据导入导出
查看MySQL数据库的命令

mysql> show databases;
mysql> CREATE DATABASE 数据库名;
mysql> use 数据库名;
mysql> source XXX.sql; #导入数据库
mysql> show tables;
mysql> desc 表名;
mysql> drop database 数据库名;
aliyun.CentOS7.MySQL操作.2017-09-27_第1张图片
status;
aliyun.CentOS7.MySQL操作.2017-09-27_第2张图片
show databases;

MySQL数据导出到表

MySql数据库导出csv
MYSQL导出数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this

将Mysql的一张表导出至Excel
pandas和数据库进行交互(以mysql为例)

mysql> show variables like '%secure%';
# secure_path
mysql> select * from table_name into outfile 'secure_path/file_name.csv' fields terminated by ',' optionally enclosed by '' lines terminated by '\n';

你可能感兴趣的:(aliyun.CentOS7.MySQL操作.2017-09-27)