我使用带有 xubuntu 桌面的 ubuntu,并使用终端安装了 mysql-server 和 mysql-client。
sudo apt-get install mysql-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.8.0-36 linux-headers-4.8.0-36-generic linux-headers-4.8.0-54 linux-headers-4.8.0-54-generic
linux-image-4.8.0-36-generic linux-image-4.8.0-54-generic linux-image-extra-4.8.0-36-generic
linux-image-extra-4.8.0-54-generic snap-confine
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
mysql-client
0 upgraded, 1 newly installed, 0 to remove and 46 not upgraded.
Need to get 10,0 kB of archives.
After this operation, 184 kB of additional disk space will be used.
Get:1 http://pl.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client all 5.7.18-0ubuntu0.16.04.1 [10,0 kB]
Fetched 10,0 kB in 0s (24,9 kB/s)
Selecting previously unselected package mysql-client.
(Reading database ... 315234 files and directories currently installed.)
Preparing to unpack .../mysql-client_5.7.18-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-client (5.7.18-0ubuntu0.16.04.1) ...
Setting up mysql-client (5.7.18-0ubuntu0.16.04.1) ...
现在我不知道如何运行 mysql 客户端以及客户端安装在哪里。
答案1
要检查安装的 MySQL 版本,请打开终端并输入:
mysql -V
我的是 5.7.18 版本
mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper
使用 MySQL
输入mysql -u username -p
然后输入安装时设置的密码。用户名通常是root
。然后开始编写 SQL 命令。
矿:
subroot@subroot:~$ mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.18-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, 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>