How to execute large MySql data-insert script file using command line in Windows 7?

别等时光非礼了梦想. 提交于 2019-12-10 09:25:00

问题


I'm new to MySQL so please guide me through how to do this via command line; I've tried but I get NO logging in the console output and the character set is not utf-8

Please help.


回答1:


Since your SQL script doesn't contain any character set configuration directives, mysql just runs in its default character set Latin1. To change the default character set, start mysql like this:

mysql -e "source /path-to-backup/backup-file.sql" db_name --default-character-set=UTF8



回答2:


mysql -e "source /path-to-backup/backup-file.sql" db_name

or

mysql db_name < backup-file.sql

You probably need -u username -p, too in your command.

mysqldump doc




回答3:


C:\<installation_path>>\bin>mysql -u<<user>> -p  database_name < your_sql_file.sql

could be used if you are getting access issues like ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

hope that helps !!



来源:https://stackoverflow.com/questions/6730111/how-to-execute-large-mysql-data-insert-script-file-using-command-line-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!