婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > ubuntu 13.04 安裝mysql數據庫教程

ubuntu 13.04 安裝mysql數據庫教程

熱門標簽:長沙智能外呼系統招商 鶴崗電銷 鶴壁電話外呼系統怎么樣 系統外呼業績 荊門智能應答電話機器人供應商 奧維地圖標注制作 哪些企業需要使用ai外呼系統 百度地圖標注任務 地圖標注多個點的位置

Ubuntu是一個流行的Linux操作系統,基于Debian發行版和GNOME桌面環境,和其他Linux發行版相比,Ubuntu非常易用,和Windows相容性很好,非常適合Windows用戶的遷移,預裝了大量常用軟件,中文版的功能也較全,支持拼音輸入法,預裝了firefox、Open Office、多媒體播放、圖像處理等大多數常用軟件,一般會自動安裝網卡、音效卡等設備的驅動。

安裝MySQL

在Ubuntu上可以使用Ubuntu Software Center或者apt命令來安裝MySQL,兩種方式都十分方便。

1. 使用Ubuntu Software Center:打開Ubuntu Software Center,在右上角的搜索框查詢mysql,然后選定MySQL Server,點擊安裝即可。

2. 使用apt:打開終端執行 ”sudo apt-get install mysql-server“ 即可。

MySQL初始配置

MySQL完成安裝后可以直接使用root賬戶登錄,且該賬戶默認是沒有密碼的。注意這里的root角色就是指你的Ubuntu的root角色,如果你當前使用的系統帳號不是root的話,也不必切換到系統root賬戶,可以在登錄MySQL的時候使用“-u"這個參數來指定登錄賬戶。如:

$ mysql -u rootmysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.00 sec)mysql> select Host, User from user;+-----------+------------------+| Host      | User             |+-----------+------------------+| 127.0.0.1 | root             || ::1       | root             || iUbuntu   |                  || iUbuntu   | root             || localhost |                  || localhost | debian-sys-maint || localhost | root             |+-----------+------------------+7 rows in set (0.00 sec)

因為此時root賬戶默認沒有密碼,所以不用輸入密碼就能以root角色登錄并查看所有信息的權限。如果換成非root角色登錄MySQL,則只擁有部分數據庫操作權限。

$ mysqlmysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || test               |+--------------------+2 rows in set (0.00 sec)mysql> use mysqlERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

因此MySQL完成安裝后的第一件事就是給root用戶設置密碼,否則數據庫將毫無安全可言。

mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "password>";

將以上命令中的password>替換為你要設定的密碼,以上命令的意思是對在本機(localhost)使用password>密碼登錄的root用戶賦予所有數據庫的操作權限。設置密碼后,如果再以root用戶登錄就需要輸入密碼了,如:

$ mysql -u rootERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)$ mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 75Server version: 5.5.34-0ubuntu0.13.10.1 (Ubuntu)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

建立數據庫獨立用戶

因為root用戶擁有數據庫的所有操作權限,所以不能輕易地提供給別人使用。在一個MySQL實例中可以創建多個數據庫,這些數據庫可能歸屬于不同項目,每個數據庫的操作角色也不一樣。對此可以針對不同那個數據庫指定用戶進行訪問。

首先使用root角色創建一個數據庫mysql> create database db_web_monitor然后將這個數據庫授予一個叫xavier的用戶使用mysql> GRANT ALL PRIVILEGES ON db_web_monitor.* TO xavier@localhost IDENTIFIED BY "xavier";

這樣就可以使用xavier用戶,密碼為xavier在本機登錄MySQL操作db_web_monitor數據庫了。

$ mysql -u xavierERROR 1045 (28000): Access denied for user 'xavier'@'localhost' (using password: NO)$ mysql -u xavier -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 77Server version: 5.5.34-0ubuntu0.13.10.1 (Ubuntu)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || db_web_monitor     || test               |+--------------------+3 rows in set (0.00 sec)mysql> 

開放遠程登錄權限

1. 首先修改MySQL的配置文件,允許監聽遠程登錄。

$ sudo vi /etc/mysql/my.cnf找到bind-address所在行 45 # Instead of skip-networking the default is now to listen only on 46 # localhost which is more compatible and is not less secure. 47 bind-address        = 127.0.0.1將 bind-address值修改為本機IP即可。注意注釋說明,如果是較老版本的MySQL,此處就應該是skip-networking,直接將其注釋即可。

2. 授予用戶遠程登錄權限。

mysql>GRANT ALL PRIVILEGES ON db_web_monitor.* TO xavier@"%" IDENTIFIED BY "xavier";

如此這般,xavier用戶就可以在任意主機通過IP訪問到本機MySQL,對db_web_monitor數據庫進行操作了。

標簽:中山 淮安 菏澤 青海 南平 鞍山 池州 開封

巨人網絡通訊聲明:本文標題《ubuntu 13.04 安裝mysql數據庫教程》,本文關鍵詞  ubuntu,13.04,安裝,mysql,數據庫,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《ubuntu 13.04 安裝mysql數據庫教程》相關的同類信息!
  • 本頁收集關于ubuntu 13.04 安裝mysql數據庫教程的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 湘潭县| 建始县| 犍为县| 遵义市| 乐业县| 新丰县| 和林格尔县| 汉源县| 岳西县| 马公市| 安多县| 石狮市| 通化县| 孟连| 保定市| 淮安市| 贡嘎县| 鹤岗市| 诸城市| 滨州市| 依安县| 新乐市| 运城市| 巍山| 永靖县| 固阳县| 竹北市| 渑池县| 商都县| 渑池县| 滦平县| 眉山市| 石林| 嘉荫县| 邵武市| 南昌市| 宜城市| 饶平县| 安陆市| 通城县| 集安市|