Linux Mint mysql-server和mysql-workbench安装和设置问题 [英] linux mint mysql-server and mysql-workbench installation and setup issue
问题描述
我试图在笔记本电脑上安装的操作系统以下
I tried to below OS installed on my laptop
Mint version 19,
Code name : Tara,
PackageBase : Ubuntu Bionic
Cinnamon (64-bit)
我已经使用以下命令安装了mysql-server:
I have installed mysql-server using below command:
xxxxxxx:~$ sudo apt-get install mysql-server
在此安装过程中,未提示我输入任何root密码. 要查看安装是否成功,我运行了以下命令:
During this installation I was not prompted to enter any root password. TO see if installation was successful, I ran below command:
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.
由于没有提示我设置任何root密码,所以我想到了设置root密码.
As I was not prompted to set any root password, I thought of setting root password.
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设置root密码的警告?如果决定使用该密码,将来是否可以在mysql工作台中使用该密码?
设置root密码(假设是正确的设置方式)后,我已经安装了mysql-workbench
After setting root password(assuming that's the right way to set it) , I have installed mysql-workbench
xxxxxxx:~$ sudo apt-get install mysql-workbench
当我启动mysql工作台时,我无法连接到 使用主机名:localhost和端口:3306的用户:root和使用mysqladmin命令设置的密码.
When I launch mysql workbench, I can't be able to connect to user:root using hostname: localhost and port: 3306 and password set using mysqladmin command.
我还尝试使用主机名:127.0.0.1,但这也不起作用.
I also tried to use hostname: 127.0.0.1 but that didn't work either.
3.如何解决mysql-workbench问题?
我在互联网上寻找答案,并尝试了多种解决方案,但没有一个奏效.
I looked on internet to find answers for this and tried multiple solutions, but none worked.
希望在这里获得更清晰的答案.
Hoping to get cleaner answer here.
推荐答案
注意:已安装 mysql工作台版本6.3 和 mysql服务器版本5.7
在安装之前,我清除了Linux计算机上的所有mysql文件/引用.
Before installing I cleaned any mysql files/references I had on my linux machine.
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_0.8.10-1_all.deb
确保所有内容都是最新的.
Made sure everything is up to date.
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服务器版本5.7
during this step chose mysql server version 5.7
- 运行完 sudo apt-get update 然后运行
- After this ran sudo apt-get update and then ran
xxxxxxxxx:~/Downloads$ sudo apt-get install mysql-server
在此步骤中,系统提示我设置root密码.最终将根密码设置为"pa $$ word"
during this step, I was prompted to to set root password. Ended up setting root password as 'pa$$word'
如果不提示您设置root密码,则可以在完成上述命令后遵循以下命令. 须藤mysql
If you are not prompted to set root password then you can follow following commands once above command is completed. 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工作台
xxxxxxxxxxx:〜/下载$ sudo apt-get install mysql-workbench
xxxxxxxxxxx:~/Downloads$ sudo apt-get install mysql-workbench
-
从Linux mint 19的开始"菜单启动mysql工作台. 在此,服务器连接具有参数,例如主机名:127.0.0.1,端口:3306,用户名:root,密码:pa $$ word .经过测试的连接-成功.
Launched mysql workbench from start menu on linux mint 19. Here Server connection has parameteres like hostname: 127.0.0.1 , port:3306, Username: root, password: pa$$word. The tested connection - successful.
双击连接即可启动实例.
double clicked connection and it launched instance fine.
这篇关于Linux Mint mysql-server和mysql-workbench安装和设置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!