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 数据库名;
status;
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';
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容