简体   繁体   English

mysql 在 linux 上的问题以及从 windows 导入转储的问题

[英]Problems with mysql on linux and also importing a dump from windows

I'm a beginner with linux (linux mint distro) and I have been trying to install mysql server and workbench.我是 linux(linux mint 发行版)的初学者,我一直在尝试安装 mysql 服务器和工作台。 I couldn't connect to mysql server without sudo command.如果没有 sudo 命令,我无法连接到 mysql 服务器。 I tried to connect to the server on workbench, and Access denied for user 'root'@'localhost' .我试图连接到工作台上的服务器,并且Access denied for user 'root'@'localhost' So I try to run workbench with sudo from terminal.所以我尝试从终端使用 sudo 运行工作台。 Nothing.没有什么。 So I followed what somebody posted here on stackoverflow about changing my password auth mode to mysql_native_password, and was able to access SQL Server from workbench (only using sudo command).所以我按照有人在stackoverflow上发布的关于将我的密码身份验证模式更改为mysql_native_password的内容,并且能够从工作台访问SQL服务器(仅使用sudo命令)。

So I try to import a dump which I made on windows mysql-workbench, and it gives me two errors:所以我尝试导入我在 windows mysql-workbench 上制作的转储,它给了我两个错误:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)错误 1045 (28000): 用户 'root'@'localhost' 的访问被拒绝(使用密码:是)

and

ERROR 1115 (42000) at line 24: Unknown character set: 'utf8_general_ci'第 24 行的错误 1115 (42000):未知字符集:'utf8_general_ci'

Nevertheless, the database seems to have been correctly imported (I can see values and columns and tables and they look alright).尽管如此,数据库似乎已正确导入(我可以看到值、列和表,它们看起来还不错)。

What's happening and how to stop getting these access denied errors?发生了什么以及如何停止这些访问被拒绝错误? I tried to search the web and there are different answers, but none of them seem to address first install.我试图搜索 web 并且有不同的答案,但似乎都没有解决首次安装问题。 I don't see why wouldn't it work if I have made a pretty default install:( Thanks a lot!如果我做了一个非常默认的安装,我不明白为什么它不起作用:(非常感谢!

ps: I don't know if more specific info is needed. ps:我不知道是否需要更具体的信息。 anonymous user was dropped after installation安装后匿名用户被删除

Try resetting root password.尝试重置root密码。

Step 1. Access to mysql using mysql -uroot步骤 1. 使用mysql -uroot

Step 2. Check the root user步骤 2. 检查 root 用户

select Host, User, authentication_string from mysql.user;

Step 3. Change password for root user步骤 3. 更改 root 用户的密码

use mysql;
update user set authentication_string=password('NEWPASSWORD') where user='root';
flush privileges;
​quit;

Now try accessing to mysql using mysql -uroot -p using new password.现在尝试使用mysql -uroot -p使用新密码访问 mysql。 If it works, use the credentials in workbench.如果可行,请使用工作台中的凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM