mysql unknown_mysql unknown command ‘”‘问题解决办法 | OurMySQL

在还原备份数据库的时候,遇到一个问题。

原来的服务器环境使用的windows,然后使用mysqldump备份出来的数据库怎么也不能在linux下的数据库中导入。导入的时候总是出现:

unknown command ‘\”‘

于是将 \’ 全部替换成 ‘  结果还是不行,导入不了。

但是直接将数据库文件copy过去就可以用的。copy过去后在dump出来。结果还是一样的效果

unknown command ‘\”‘

郁闷至极。

经过多是导出导入发现,原来默认安装的mysql使用的是utf8编码,而我本机安装的是mysql gbk数据库。这样一来,备份文件恢复的时候可能就出现了格式错误。

后来在dump的时候指定字符集 mysqldump加个参数: -default-character-set=gbk,再次导入备份文件,一切顺利。

mysqldump -u root -p  –opt –allow-keywords –default-character-set=gbk databases > /PATH/XXX.sql

非默认字符集,在导入导出注意指定相应的字符集

觉得文章有用?立即:

和朋友一起 共学习 共进步!

猜您喜欢

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The warning message you're seeing is a standard security concern when using MySQL through a command-line interface, such as `mysql` or `mysqladmin`. It's advising that providing a password directly on the command line can be less secure because anyone monitoring your terminal session could potentially see it. For better protection, it's recommended to use tools like `mysql_secure_installation` or configuration files with hashed passwords. The error message `ERROR 1049 (42000): Unknown database 'parking_guidance'` indicates that MySQL cannot find the database you are trying to access. Here's what you can do to resolve this issue: 1. **Check if the database exists:** Use the `SHOW DATABASES;` command to ensure that the 'parking_guidance' database is indeed not present in your current setup. 2. **Create the database:** If it doesn't exist, run the following command to create it: ``` CREATE DATABASE parking_guidance; ``` 3. **Grant privileges:** If you have not already done so, you'll need to grant privileges to your user account to access this new database. For example: ``` GRANT ALL PRIVILEGES ON parking_guidance.* TO 'your_username'@'localhost' IDENTIFIED BY 'your_password'; ``` Replace 'your_username' and 'your_password' with your actual MySQL credentials. 4. **Switch to the new database:** After granting privileges, use `USE parking_guidance;` to switch to the newly created database. 5. **Confirm connection:** Double-check that you can connect to the 'parking_guidance' database without any errors by running a simple query. If you've already created the database and granted privileges, check for typos in the database name or user credentials. Make sure they match exactly as you specified them.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值