简体   繁体   English

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)

I have installed mysql-server using below command:我已经使用以下命令安装了 mysql-server:

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

During this installation I was not prompted to enter any root password.在这个安装过程中,我没有被提示输入任何 root 密码。 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.

As I was not prompted to set any root password, I thought of setting root password.由于没有提示我设置任何root密码,我想到了设置root密码。

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. Why I can't be able to use "mysqladmin" command without being logged in as root? 1. 为什么我不以root身份登录就不能使用“mysqladmin”命令?

2. How to fix the warning for mysqladmin set root password? 2. 如何修复mysqladmin 设置root 密码的警告? ANd can I be able to use that password inside mysql workbench in future if decide to use it?如果我决定使用它,我将来可以在 mysql 工作台中使用该密码吗?


After setting root password(assuming that's the right way to set it) , I have installed mysql-workbench设置 root 密码后(假设这是设置它的正确方法),我已经安装了 mysql-workbench

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

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.当我启动 mysql 工作台时,我无法使用主机名:localhost 和端口:3306 和使用 mysqladmin 命令设置的密码连接到用户:root。

I also tried to use hostname: 127.0.0.1 but that didn't work either.我也尝试使用主机名:127.0.0.1 但这也不起作用。

3. How to fix mysql-workbench issue? 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.希望在这里得到更清晰的答案。

Note: Installed mysql workbench version 6.3 and mysql server version 5.7注意:安装了mysql workbench 6.3版mysql server 5.7版

Before installing I cleaned any mysql files/references I had on my linux machine.在安装之前,我清理了我的 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

Below steps worked fine for me -以下步骤对我来说很好-

  1. Go to the download page for the MySQL APT repository at https://dev.mysql.com/downloads/repo/apt/ and downloaded mysql-apt-config_0.8.10-1_all.deb转到https://dev.mysql.com/downloads/repo/apt/ 上的 MySQL APT 存储库的下载页面并下载mysql-apt-config_0.8.10-1_all.deb

  2. Made sure everything is up to date.确保一切都是最新的。

 xxxxxxxxx:~/Downloads$ sudo apt-get update
  1. installed downloaded deb file.安装下载的 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

during this step chose mysql server version 5.7在此步骤中选择 mysql 服务器版本 5.7

  1. After this ran sudo apt-get update and then ran在此之后运行sudo apt-get update然后运行
xxxxxxxxx:~/Downloads$ sudo apt-get install mysql-server

during this step, I was prompted to to set root password.在这一步中,我被提示设置 root 密码。 Ended up setting root password as 'pa$$word'最终将 root 密码设置为 'pa$$word'

If you are not prompted to set root password then you can follow following commands once above command is completed.如果没有提示您设置 root 密码,那么您可以在完成上述命令后按照以下命令进行操作。 sudo mysql须藤mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pa$$word';
exit;
  1. After installation is successful checked status安装成功后检查状态
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.
  1. Then tried to check if I can go to mysql prompt.然后尝试检查我是否可以转到 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
  1. Then installed mysql workbench using below command然后使用以下命令安装mysql工作台

xxxxxxxxxxx:~/Downloads$ sudo apt-get install mysql-workbench xxxxxxxxxxx:~/Downloads$ sudo apt-get install mysql-workbench

  1. 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 .在 linux mint 19 上从开始菜单启动 mysql workbench。这里服务器连接有参数,如主机名:127.0.0.1,端口:3306,用户名:root,密码:pa$$word The tested connection - successful.测试连接 - 成功。

  2. double clicked connection and it launched instance fine.双击连接并启动实例正常。

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

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