linux mint mysql server和mysql workbench安装和设置问题

b5buobof  于 2021-06-19  发布在  Mysql
关注(0)|答案(1)|浏览(500)

我试图在笔记本电脑上安装一个操作系统

Mint version 19, 
Code name : Tara,
PackageBase : Ubuntu Bionic
Cinnamon (64-bit)

我使用以下命令安装了mysql server:

xxxxxxx:~$ sudo apt-get install mysql-server

在这个安装过程中,没有提示我输入任何根密码。为了查看安装是否成功,我运行了以下命令:

xxxxxxxxxx:~$ mysql -V
mysql  Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using  EditLine wrapper
xxxxxxxxxx:~$ sudo service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2018-09-30 21:59:42 EDT; 9s ago
 Main PID: 3518 (mysqld)
    Tasks: 27 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─3518 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

Sep 30 21:59:41 globallogic systemd[1]: Starting MySQL Community Server...
Sep 30 21:59:42 globallogic systemd[1]: Started MySQL Community Server.

由于没有提示我设置任何根密码,我想到了设置根密码。

xxxxxxxx:~$ mysqladmin -u root password
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost''
xxxxxxxx:~$ sudo mysqladmin -u root password
New password: 
Confirm new password: 
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

1为什么不以root身份登录就不能使用“mysqladmin”命令?
2如何修复mysqladmin set root password的警告?如果我决定使用mysql workbench的密码,我将来能在里面使用它吗?
在设置了root密码(假设这是正确的设置方法)之后,我已经安装了mysql workbench

xxxxxxx:~$ sudo apt-get install mysql-workbench

当我启动mysql workbench时,我无法连接到user:root using 主机名:localhost,端口:3306,使用mysqladmin命令设置密码。
我还尝试使用hostname:127.0.0.1,但也没有成功。
三。如何解决mysql工作台问题?
我在互联网上寻找答案,并尝试了多种解决方案,但都没有奏效。
希望得到更清晰的答案。

pieyvz9o

pieyvz9o1#

注意:已安装mysql workbench版本6.3和mysql server版本5.7
在安装之前,我清理了linux机器上的所有mysql文件/引用。

sudo apt-get remove --purge mysql*  
sudo apt-get purge mysql*  
sudo apt-get autoremove  
sudo apt-get autoclean  
sudo apt-get remove dbconfig-mysql

下面的台阶很适合我-
转到mysql apt存储库的下载页面https://dev.mysql.com/downloads/repo/apt/ 并下载mysql-apt-config\ u 0.8.10-1\ u all.deb
确保一切都是最新的。

xxxxxxxxx:~/Downloads$ sudo apt-get update

已安装下载的deb文件。

xxxxxxxxx:~/Downloads$ sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb 
Selecting previously unselected package mysql-apt-config.
(Reading database ... 273762 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.10-1_all.deb ...
Unpacking mysql-apt-config (0.8.10-1) ...
Setting up mysql-apt-config (0.8.10-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK

在此步骤中,选择mysql server 5.7版
在这之后运行sudo apt get update然后运行

xxxxxxxxx:~/Downloads$ sudo apt-get install mysql-server

在这个步骤中,我被提示设置根密码。最后将根密码设置为“pa$$word”
如果没有提示您设置根密码,则在完成上述命令后,可以执行以下命令。sudo mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pa$$word';
exit;

安装成功后检查状态

xxxxxxxxx:~/Downloads$ sudo service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-10-01 15:31:19 EDT; 29s ago
 Main PID: 23029 (mysqld)
    Tasks: 27 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─23029 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Oct 01 15:31:18  systemd[1]: Starting MySQL Community Server...
Oct 01 15:31:19  systemd[1]: Started MySQL Community Server.

然后尝试检查是否可以转到mysql提示符。

xxxxxxxx:~/Downloads$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> quit
Bye

然后使用下面的命令安装mysql workbench
x:~/下载$sudo apt get install mysql workbench
在linux mint 19上从“开始”菜单启动了mysql workbench。这里的服务器连接有如下参数:hostname:127.0.0.1,port:3306,用户名:root,密码:pa$$word。测试的连接-成功。
双击连接,它启动了instance fine。

相关问题