阿里云Ubuntu 16.04 部署Mysql数据库


买了一台阿里云的服务器,想搞搞事情。于是乎,准备搭建了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

你可能感兴趣的:(Ubuntu,阿里云,mysql)