阿里云服务器Ubuntu系统下mysql安装

1、Ubuntu系统下mysql安装

一、通过ssh登录阿里云服务器,查看是否安装了mysql。

root@iZm5ehpd3tjpeb8jq2pghhZ:~# sudo netstat -tap | grep mysql

root@iZm5ehpd3tjpeb8jq2pghhZ:~# 

出现以上情况,则表明没有安装数据库

二、安装mysql数据库。

1、输入下面指令,进行安装。

root@--:~# sudo apt-get install mysql-server mysql-client

2、安装过程出现下面界面,进行设置密码即可。

 

3、安装完成,测试。

root@iZm5ehpd3tjpeb8jq2pghhZ:~# mysql --version

mysql  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

三、数据操作指令。

1、mysql打开状态。

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql status

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-09-12 14:46:28 CST; 1 day 20h ago
  Process: 2211 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 2201 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2210 (mysqld)
   CGroup: /system.slice/mysql.service
           └─2210 /usr/sbin/mysqld

Sep 12 14:46:27 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Starting MySQL Community Server...
Sep 12 14:46:28 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Started MySQL Community Server.

 

2、打开/关闭数据库。

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql stop

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql status

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql stop
root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2018-09-14 10:50:34 CST; 3s ago
  Process: 2211 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 2210 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
  Process: 2201 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2210 (code=exited, status=0/SUCCESS)

Sep 12 14:46:27 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Starting MySQL Community Server...
Sep 12 14:46:28 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Started MySQL Community Server.
Sep 14 10:50:31 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Stopping MySQL Community Server...
Sep 14 10:50:34 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Stopped MySQL Community Server.

 

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql start

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql status

root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql start
root@iZm5ehpd3tjpeb8jq2pghhZ:~# service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-09-14 10:51:22 CST; 1s ago
  Process: 4803 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 4793 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 4802 (mysqld)
   CGroup: /system.slice/mysql.service
           └─4802 /usr/sbin/mysqld

Sep 14 10:51:21 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Starting MySQL Community Server...
Sep 14 10:51:22 iZm5ehpd3tjpeb8jq2pghhZ systemd[1]: Started MySQL Community Server.

 

二、使用navicat连接阿里云服务器的mysql数据库出现10038错误的解决办法

1、在阿里云服务器添加安全组规则,开放3306接口。

出口方也要对应的配置

 

修改/etc/mysql/mysql.conf.d/mysqld.cnf文件 将bind-address    = 127.0.0.1

 设置成bind-address    = 0.0.0.0(设备地址)

连接成功:

 

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值