【问题标题】:linux mint mysql-server and mysql-workbench installation and setup issuelinux mint mysql-server 和 mysql-workbench 安装和设置问题
【发布时间】:2019-03-06 03:41:45
【问题描述】:

我尝试在我的笔记本电脑上安装以下操作系统

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

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

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

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

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密码。

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

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

当我启动 mysql 工作台时,我无法连接到 用户:root 使用主机名:localhost 和端口:3306 并使用 mysqladmin 命令设置密码。

我也尝试使用主机名:127.0.0.1,但这也没有用。

3.如何修复 mysql-workbench 问题?

我在互联网上寻找答案并尝试了多种解决方案,但都没有奏效。

希望在这里得到更清晰的答案。

【问题讨论】:

    标签: mysql mysql-workbench linux-mint mysqladmin


    【解决方案1】:

    注意:安装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
    

    以下步骤对我来说效果很好 -

    1. 转到位于https://dev.mysql.com/downloads/repo/apt/ 的 MySQL APT 存储库的下载页面并下载 mysql-apt-config_0.8.10-1_all.deb

    2. 确保一切都是最新的。

    xxxxxxxxx:~/Downloads$ sudo apt-get update
    
    1. 已安装下载的 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 version 5.7

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

    在此步骤中,系统提示我设置 root 密码。最终将root密码设置为'pa$$word'

    如果没有提示您设置 root 密码,那么您可以在完成上述命令后执行以下命令。 sudo mysql

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pa$$word';
    exit;
    
    1. 安装成功后检查状态
    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. 然后尝试检查是否可以进入 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. 然后使用以下命令安装 mysql 工作台

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

    1. 从 linux mint 19 的开始菜单启动 mysql 工作台。 这里服务器连接的参数有 hostname: 127.0.0.1 , port:3306, Username: root, password: pa$$word。测试的连接 - 成功。

    2. 双击连接并启动实例正常。

    【讨论】:

      猜你喜欢
      • 2021-07-13
      • 1970-01-01
      • 2016-12-06
      • 2011-02-01
      • 2014-12-09
      • 2019-08-26
      • 2019-09-10
      • 2019-01-20
      • 2020-11-25
      相关资源
      最近更新 更多