日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

ubunt11 安装mysql_ubuntu 11.10安装mysql

發布時間:2023/12/10 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubunt11 安装mysql_ubuntu 11.10安装mysql 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. 安裝

devadm@devserver:~$ sudo apt-get install mysql-server

......

The following NEW packages will be installed:

libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16

libnet-daemon-perl libplrpc-perl mysql-client-5.1 mysql-client-core-5.1

mysql-common mysql-server mysql-server-5.1 mysql-server-core-5.1

0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded.

Need to get 23.8 MB of archives.

After this operation, 61.2 MB of additional disk space will be used.

Do you want to continue [Y/n]?

......

【mysql root 密碼設為:mygreatsecret】

......

2. 服務器配置

1)編輯配置文件

devadm@devserver:~$ sudo vim /etc/mysql/my.cnf

將 'bind-address = 127.0.0.1' 替換為:

bind-address = 0.0.0.0

2)防火墻,別忘了防火墻!

devadm@devserver:~$ sudo ufw allow mysql

Rule added

Rule added (v6)

devadm@devserver:~$

devadm@devserver:~$ sudo ufw status

Status: active

To???????????????????????? Action????? From

--???????????????????????? ------????? ----

22/tcp???????????????????? ALLOW?????? Anywhere

139/tcp??????????????????? ALLOW?????? Anywhere

445/tcp??????????????????? ALLOW?????? Anywhere

8080/tcp?????????????????? ALLOW?????? Anywhere

3306?????????????????????? ALLOW?????? Anywhere

22/tcp???????????????????? ALLOW?????? Anywhere (v6)

139/tcp??????????????????? ALLOW?????? Anywhere (v6)

445/tcp??????????????????? ALLOW?????? Anywhere (v6)

8080/tcp?????????????????? ALLOW?????? Anywhere (v6)

3306?????????????????????? ALLOW?????? Anywhere (v6)

devadm@devserver:~$

3)本機連接,配置用戶和用戶數據庫

devadm@devserver:~$ mysql -h 127.0.0.1 -u root -p

Enter password:

Welcome to the MySQL monitor.? Commands end with ; or \g.

Your MySQL connection id is 43

Server version: 5.1.58-1ubuntu1 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE devcom;

mysql> CREATE USER dev;

mysql> GRANT ALL PRIVILEGES ON devcom.* TO 'dev'@'%' ;

mysql> SET PASSWORD FOR 'dev'@'%' = PASSWORD('mylittlesecret');

mysql>

mysql> quit;

Bye

devadm@devserver:~$

3.客戶端

1)安裝mysql-client

gt@gt-Dell:~$ sudo apt-get install mysql-client

連接,創建用戶表,插入測試數據

gt@gt-Dell:~$ mysql -h devserver -u dev -p

Enter password:

Welcome to the MySQL monitor.? Commands end with ; or \g.

Your MySQL connection id is 39

Server version: 5.1.58-1ubuntu1 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> USE devcom

\Database changed

mysql> CREATE TABLE devuser (dev_id int, dev_name char(20));

mysql> INSERT INTO devuser (dev_id,dev_name) VALUES(1001,'Pan Black');

Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM DEVUSER;

ERROR 1146 (42S02): Table 'devcom.DEVUSER' doesn't exist

mysql> SELECT * FROM devuser;

+--------+-----------+

| dev_id | dev_name? |

+--------+-----------+

|?? 1001 | Pan Black |

+--------+-----------+

1 row in set (0.00 sec)

mysql>

總結

以上是生活随笔為你收集整理的ubunt11 安装mysql_ubuntu 11.10安装mysql的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。