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

歡迎訪問 生活随笔!

生活随笔

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

数据库

mysql ubuntu 17.04_1、mysql 5.7 ubuntu17.04

發布時間:2025/3/8 数据库 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql ubuntu 17.04_1、mysql 5.7 ubuntu17.04 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

系統:ubuntu17.04

數據庫主要分文檔型和服務型兩類:

文檔型:如sqlite3 (17.04自帶/usr/bin/sqlite3)就是一個文件,應用在移動端如手機,pad,家電等

服務型:如mysql有服務端(存儲數據)和客戶端

mysql數據庫是關系型數據庫,采用E-R模型即實體-聯系(或關系)模型

安裝:

sudo apt install mysql-server,需要設置密碼:xxx

sudo apt install mysql-client

sudo apt install libmysqlclient-dev

lyb@lyb:~$ sudo netstat -tap |grep mysql

tcp0 0 localhost:mysql *:* LISTEN 5167/mysqld

成功安裝

登錄:

l@l:~$ mysql -uroot -pxxx

mysql: [Warning] Using a password on the command lineinterfacecan be insecure.

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

Your MySQL connection idis 5Server version:5.7.20-0ubuntu0.16.04.1(Ubuntu)

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

Oracleis 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>show databases;  #初始有四個數據庫+--------------------+

| Database |

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

| information_schema |

| mysql |

| performance_schema |

| sys |

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

4 rows in set (0.16sec)

創建用戶并授權:

mysql> create user 'l'@'%' identified by '123';

Query OK,0 rows affected (0.09sec)

mysql> select user,host fromuser;+---------------+-----------+

| user | host |

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

| l | % |

| mysql.session | localhost |

| mysql.sys | localhost |

| root | localhost |

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

4 rows in set (0.00sec)

mysql> grant select on study.* to 'l'@'%';

desc ?user;  #顯示其中user表的結構,如下:

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

| Field | Type | Null | Key | Default | Extra |

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

| Host | char(60) | NO | PRI | | |

| User | char(32) | NO | PRI | | |

| Select_priv | enum('N','Y') | NO | | N | |

| Insert_priv | enum('N','Y') | NO | | N | |

| Update_priv | enum('N','Y') | NO | | N | |

| Delete_priv | enum('N','Y') | NO | | N | |

| Create_priv | enum('N','Y') | NO | | N | |

| Drop_priv | enum('N','Y') | NO | | N | |

| Reload_priv | enum('N','Y') | NO | | N | |

| Shutdown_priv | enum('N','Y') | NO | | N | |

| max_user_connections | int(11) unsigned | NO | | 0 | |

| plugin | char(64) | NO | | mysql_native_password | |

| authentication_string | text | YES | | NULL | |

| password_expired | enum('N','Y') | NO | | N | |

| password_last_changed | timestamp | YES | | NULL | |

| password_lifetime | smallint(5) unsigned | YES | | NULL | |

| account_locked | enum('N','Y') | NO | | N | |

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

注:字段創建要有數據類型,長度;Null是否為空,NO表示不能為空;PRI表示主鍵,一般是一個,本表前兩個是聯合主鍵

select ?字段 ?from ?表

exit;  #從mysql數據庫退出

ps -ef |grep mysql  #在命令行從所有進程篩選mysql

總結

以上是生活随笔為你收集整理的mysql ubuntu 17.04_1、mysql 5.7 ubuntu17.04的全部內容,希望文章能夠幫你解決所遇到的問題。

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