MYSQL快速导入大量数据
創(chuàng)建數(shù)據(jù)表,并導(dǎo)入
1.根據(jù)數(shù)據(jù)特征建表,create語句
2.語句導(dǎo)入數(shù)據(jù)
第一行是導(dǎo)入csv文件的地址,
第二行是插入table表,
第三行指定編碼方式 :
fields terminated by ”:這是指出csv文件中字段終止符,也就是數(shù)據(jù)之間的分隔符;
enclosed by ”:指出封套符;
lines terminated by ”:指行終止符
出現(xiàn)1290問題
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
解決 secure_file_priv null問題
原因:
MySql數(shù)據(jù)庫在導(dǎo)出數(shù)據(jù)庫時,是有限制的。不能隨隨便便讓別人把數(shù)據(jù)庫中的數(shù)據(jù)導(dǎo)出,
這是通過my.ini文件【mysql的系統(tǒng)配置文件】中的secure_file_priv參數(shù)來實現(xiàn)的,具體用法如下:
1、限制mysqld 不允許導(dǎo)入/導(dǎo)出 secure_file_priv=null
2、限制mysqld 的導(dǎo)入/導(dǎo)出 只能發(fā)生在/tmp/目錄下 secure_file_priv=/tmp/
#3、不對mysqld 的導(dǎo)入/導(dǎo)出做限制【什么都不設(shè)置】secure_file_priv = ’ ’
步驟:
1.在mysql安裝目錄的my.ini文件文末添加secure_file_priv = ’ ';
2.以管理員身份運行cmd,進入mysql/bin停止mysql服務(wù)net stop mysql,重新啟動mysql服務(wù)net start mysql,登入mysql mysql -u root -p enter password: password
3.執(zhí)行命令show variables like ‘%secure%’;查看secure_file_priv的值。
總結(jié)
以上是生活随笔為你收集整理的MYSQL快速导入大量数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScript入门介绍 1 202
- 下一篇: mysql 默认page大小_MySQL