当前位置:   article > 正文

ubuntu安装MySQL_metapackage depending on the latest version

metapackage depending on the latest version

目录

安装

搜索mysql安装包

安装mysql-server

 安装mysql-client

安装程序编译链接库

测试

通过监听端口或者进程检测是否安装成功

连接mysql


安装

搜索mysql安装包

Ubuntu安装MySQL一般是用作服务端,可以只安装服务端。

  1. # 更新软件源
  2. root@ubuntu:~# apt-get update
  3. # 搜索MySQL软件包
  4. root@ubuntu:~# apt-cache search mysql | grep ^mysql
  5. mysql-client - MySQL database client (metapackage depending on the latest version)
  6. mysql-client-5.7 - MySQL database client binaries
  7. mysql-client-core-5.7 - MySQL database core client binaries
  8. mysql-common - MySQL database common files, e.g. /etc/mysql/my.cnf
  9. mysql-server - MySQL database server (metapackage depending on the latest version)
  10. mysql-server-5.7 - MySQL database server binaries and system database setup
  11. mysql-server-core-5.7 - MySQL database server binaries
  12. mysql-mmm-agent - Multi-Master Replication Manager for MySQL - agent daemon
  13. mysql-mmm-common - Multi-Master Replication Manager for MySQL - common files
  14. mysql-mmm-monitor - Multi-Master Replication Manager for MySQL - monitoring daemon
  15. mysql-mmm-tools - Multi-Master Replication Manager for MySQL - tools
  16. mysql-sandbox - Install and set up one or more MySQL server instances easily
  17. mysql-source-5.7 - MySQL source
  18. mysql-testsuite - MySQL regression tests
  19. mysql-testsuite-5.7 - MySQL 5.7 testsuite
  20. mysql-utilities - collection of scripts for managing MySQL servers
  21. mysql-workbench - MySQL Workbench - a visual database modeling, administration and queuing tool
  22. mysql-workbench-data - MySQL Workbench -- architecture independent data
  23. mysqltcl - interface to the MySQL database for the Tcl language
  24. mysqltuner - high-performance MySQL tuning script

从以上搜索结果可知有2个版本,一个是5.7版本,一个没有版本号,没有版本号的是最新版本。

此处安装最新版本。

安装mysql-server

root@ubuntu:~# apt-get install mysql-server -y

安装过程中会配置root账号的密码:

 安装mysql-client

root@ubuntu:~# apt-get install mysql-client -y

安装程序编译链接库

root@ubuntu:~# apt-get install libmysql++-dev -y

测试

通过监听端口或者进程检测是否安装成功

  1. root@ubuntu:~# netstat -tap | grep mysql
  2. tcp 0 0 localhost:mysql *:* LISTEN 3997/mysqld
  3. # 也可以检测mysql进程
  4. root@ubuntu:~# ps aux | grep mysql
  5. mysql 3997 0.3 3.3 1114692 136788 ? Ssl 23:15 0:03 /usr/sbin/mysqld
  6. root 9104 0.0 0.0 14220 936 pts/0 S+ 23:31 0:00 grep --color=auto mysql

连接mysql

使用命令"mysql -u root -p"连接

也可以使用命令"mysql -u root -p密码"连接MySQL,注意:-p后直接跟密码,没有空格

  1. root@ubuntu:~# mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 11
  5. Server version: 5.7.33-0ubuntu0.16.04.1 (Ubuntu)
  6. Copyright (c) 2000, 2021, Oracle and/or its affiliates.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  11. mysql>

至此,安装完成。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/947395
推荐阅读
相关标签
  

闽ICP备14008679号