阿里云Ubuntu 16.04 部署Mysql数据库

2 篇文章 0 订阅
2 篇文章 0 订阅

买了一台阿里云的服务器,想搞搞事情。于是乎,准备搭建了Mysql数据库,下面是具体的操作流程

1.安装mysql服务端 sudo apt-get install mysql-server

root@*************:~# sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...(过多省略)
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

2.安装mysql客户端 sudo apt-get install mysql-client

root@*************:~# sudo apt-get install mysql-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...(过多省略)
Unpacking mysql-client (5.7.24-0ubuntu0.16.04.1) ...
Setting up mysql-client (5.7.24-0ubuntu0.16.04.1) ...

3.执行 sudo apt install libmysqlclient-dev

root@*************:~# sudo apt install libmysqlclient-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...(过多省略)
After this operation, 11.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Abort.

执行上面步骤只能使用root权限执行,中途需要设置MySQL密码

4.验证Mysql安装成功 sudo netstat -tap | grep mysql

出现下图表示安装成功
root@*************:~# sudo netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      1745/mysqld     
Abort.

5.【登录Mysql数据库】

mysql -uroot -p1234
-u后面的root表示登录名,-p后面的1234表示登录密码,在前面的步骤中设置。执行命令如果出现下图,表示数据库创建成功
root@*************:~# mysql -uroot -p1234
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.24-0ubuntu0.16.04.1 (Ubuntu)

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

到这就ok了,如果需要配置数据库远程访问,可以参考这里 https://blog.csdn.net/Jamel_LiToo/article/details/84349288

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值