且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux Mint mysql-server和mysql-workbench安装和设置问题

更新时间:2023-01-31 07:37:14

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

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

  1. 转到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

  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服务器版本5.7

during this step chose mysql server version 5.7

  1. 运行完 sudo apt-get update 然后运行
  1. 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;

  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:〜/下载$ sudo apt-get install mysql-workbench

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

  1. 从Linux mint 19的开始"菜单启动mysql工作台. 在此,服务器连接具有参数,例如主机名:127.0.0.1,端口:3306,用户名:root,密码:pa $$ word .经过测试的连接-成功.

  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. The tested connection - successful.

双击连接即可启动实例.

double clicked connection and it launched instance fine.