[linux上路] 开发环境准备二 Debian8 通过APT Repository资源安装Mysql

来源:互联网 发布:数据统计分析基础 编辑:程序博客网 时间:2024/06/15 04:29

A Quick Guide to Using the MySQL APT Repository
https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-install-components

Adding the MySQL APT Repository添加APT Repository资源地址.

第一步:Download MySQL APT Repository下载资源地址安装包 mysql-apt-config_0.8.5-1_all.deb

shell> sudo dpkg -i mysql-apt-config_w.x.y-z_all.deb

第二步:During the installation of the package, you will be asked to choose the versions of the MySQL server and other components (for example, the MySQL Workbench) that you want to install. If you are not sure which version to choose, do not change the default options selected for you. You can also choose none if you do not want a particular component to be installed. After making the choices for all components, choose Ok to finish the configuration and installation of the release package.
安装过程中,会问你选择Mysql的版本和想安装的其他组件,如果你不确定选择哪个版本就不要修改默认选项,选择OK结束设置并开始安装。

第三步:Update package information from the MySQL APT repository with the following command (this step is mandatory):如果要更新软件包,执行

shell> sudo apt-get update

Adding and Configuring the MySQL APT Repository Manually

Instead of using the release package, you can also add and configure the MySQL APT repository manually; see Appendix A: Adding and Configuring the MySQL APT Repository Manually for details.可以手动设置APT repository,我就是手动设置的,用deb包安装资源的方式我没有成功。
https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-repo-manual-setup

1.Download the MySQL GPG Public key (see Signature Checking Using GnuPG on how to do that) and save it to a file, without adding any spaces or special characters. Then, add the key to your system’s GPG keyring with the following command:下载Mysql GPG Public key并安装。

shell> sudo apt-key add path/to/signature-file

2.Alternatively, you can download the GPG key to your APT keyring directly using the apt-key utility:另外,也可以用apt-key utility直接下载到APT keyring(这个翻译叫密钥串)

shell> sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5 

3.Create a file named /etc/apt/sources.list.d/mysql.list, and put into it repository entries in the following format:创建一个文件,路径/etc/apt/sources.list.d/,文件名mysql.list把这句加到文件里

deb http://repo.mysql.com/apt/{debian|ubuntu}/ {jessie|wheezy|trusty|utopic|vivid} {mysql-5.6|mysql-5.7|workbench-6.2|utilities-1.4|connector-python-2.0}

4.Use the following command to get the most up-to-date package information from the MySQL APT repository:

shell> sudo apt-get update

Installing MySQL with APT

第一步:Install MySQL by the following command:

shell> sudo apt-get install mysql-server

This installs the package for the MySQL server, as well as the packages for the client and for the database common files.

第二步:During the installation, there are two requests by the dialogue boxes:
(1)Supply a password for the root user for your MySQL installation.问root密码
(2)Indicate if you want to install the test database with “Yes” or “No.” Installation of the test database is not recommended for production environments.问是否安装test数据库

Starting and Stopping the MySQL Server

The MySQL server is started automatically after installation. You can check the status of the MySQL server with the following command:安装完毕后Mysql服务会自动启动,你可以检查服务状态

shell> sudo service mysql status

Stop the MySQL server with the following command:停止服务

shell> sudo service mysql stop

To restart the MySQL server, use the following command:启动服务

shell> sudo service mysql start

至此,基本的安装就完成了,输入下面的命令查看是否安装成功

shell> sudo mysql -u root -p

显示:

clementine@debian:~$ sudo mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.7.18 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 
0 0
原创粉丝点击