银河麒麟4.0.2(飞腾平台) 安装MySQL数据库

1. 操作系统信息

root@Kylin:/# cat /etc/.kyinfo
[dist]
name=Kylin
milestone=4.0.2-server-sp2-18071110.Z1
arch=arm64
beta=False
time=2018-07-11 10:57:13
dist_id=Kylin-4.0.2-server-sp2-18071110.Z1-arm64-2018-07-11 10:57:13

2. 更换系统源文件

## 备份原来的文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old    
## 修改sources.list文件
sudo vim /etc/apt/sources.list      

配置文件内容如下所示:

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
#deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
#deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
#deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
#deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe

3. 更新镜像源

sudo apt update  

4. 安装MySQL5.7

## 卸载之前安装的mysql
sudo apt-get remove --purge mysql-\*
sudo apt-get install mysql-server mysql-client
(需要输入两次mysql的root用户的密码)
软件包设置
┌──────────────────────────┤ 正在设定 mysql-server-5.7 ├───────────────────────────┐
│ While not mandatory, it is highly recommended that you set a password for the   │
│ MySQL administrative "root" user.                                               │
│                                                                                 │
│ If this field is left blank, the password will not be changed.                  │
│                                                                                 │
│ New password for the MySQL "root" user:                                         │
│                                                                                 │
│ *********______________________________________________________________________ │
│                                                                                 │
│                                     <确定>                                      │
│                                                                                 │
└─────────────────────────────────────────────────────────────────────────────────┘
软件包设置
┌────────┤ 正在设定 mysql-server-5.7 ├─────────┐
│                                             │
│                                             │
│ Repeat password for the MySQL "root" user:  │
│                                             │
│ *********__________________________________ │
│                                             │
│                   <确定>                    │
│                                             │
└─────────────────────────────────────────────┘

5.安装完成,查看并登录MySQL

# 查看mysql版本
root@Kylin:/# mysql -V
mysql  Ver 14.14 Distrib 5.7.11, for Linux (aarch64) using  EditLine wrapper
root@Kylin:/# 
root@Kylin:/# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.11-0ubuntu6 (Ubuntu)

Copyright (c) 2000, 2016, 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> 

6. 配置mysql

  1. 配置远程连接
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 
## 找到 bind-address 修改值为 0.0.0.0 后保存

## 重启MySQL
sudo /etc/init.d/mysql restart 
  1. 为用户授权远程连接服务
root@Kylin:/# mysql -u root -p
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root密码' with grant option;
mysql> flush privileges;
## 退出mysql,重启MySQL
root@Kylin:/# sudo /etc/init.d/mysql restart 

posted @ 2023-03-22 15:02  盐有点多  阅读(470)  评论(0编辑  收藏  举报