1. 程式人生 > >ubuntu14.04安裝mysql服務

ubuntu14.04安裝mysql服務

[email protected]:/usr/mysql# tar -xf mysql-server_5.7.16-1ubuntu14.04_amd64.deb-bundle.tar 
[email protected]:/usr/mysql# ll
total 517072
drwxr-xr-x  2 root root       4096 Nov 26 14:26 ./
drwxr-xr-x 30 root root       4096 Nov 26 14:02 ../
-rw-r--r--  1 root root       6364 Nov 10 16:45 libaio1_0.3.109-4_amd64
.deb -rw-r--r-- 1 root root 243908 Nov 11 00:10 libmecab2_0.996-1.1_amd64.deb -rw-r--r-- 1 7155 31415 1174550 Sep 29 00:03 libmysqlclient-dev_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 828454 Sep 29 00:03 libmysqlclient20_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 16974998 Sep 29
00:03 libmysqld-dev_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 12628 Sep 29 00:03 mysql-client_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 31124 Sep 29 00:03 mysql-common_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 7049544 Sep 29 00:03 mysql-community-client_5.7.16-1ubuntu14
.04_amd64.deb -rw-r--r-- 1 7155 31415 20368932 Sep 29 00:03 mysql-community-server_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 194167434 Sep 29 00:03 mysql-community-source_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 23943094 Sep 29 00:03 mysql-community-test_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 7155 31415 6823 Sep 29 00:03 mysql-community_5.7.16-1ubuntu14.04_amd64.changes -rw-r--r-- 1 7155 31415 12624 Sep 29 00:03 mysql-server_5.7.16-1ubuntu14.04_amd64.deb -rw-r--r-- 1 root root 264601600 Nov 10 16:03 mysql-server_5.7.16-1ubuntu14.04_amd64.deb-bundle.tar -rw-r--r-- 1 7155 31415 12634 Sep 29 00:03 mysql-testsuite_5.7.16-1ubuntu14.04_amd64.deb [email protected]:/usr/mysql#

注意 :libaio1_0.3.109-4_amd64.deb,libmecab2_0.996-1.1_amd64.deb並不是mysql安裝包中的安裝檔案而是mysql安裝需要的依賴 。在安裝過程中可能會出現不同的依賴需要安裝。具體檔案可以在下載地址中下載

首先安裝依賴

[email protected]:/usr/mysql# dpkg -i libaio1_0.3.109-4_amd64.deb 
Selecting previously unselected package libaio1:amd64.
(Reading database ... 180240 files and directories currently installed.)
Preparing to unpack libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) over (0.3.109-4) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
[email protected]:/usr/mysql# 
[email protected]:/usr/mysql# dpkg -i libmecab2_0.996-1.1_amd64.deb 
(Reading database ... 180240 files and directories currently installed.)
Preparing to unpack libmecab2_0.996-1.1_amd64.deb ...
Unpacking libmecab2 (0.996-1.1) over (0.996-1.1) ...
Setting up libmecab2 (0.996-1.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
[email protected]:/usr/mysql#

再安裝mysql-common_5.7.16-1ubuntu14.04_amd64.deb

[email protected]:/usr/mysql# dpkg -i mysql-common_5.7.16-1ubuntu14.04_amd64.deb 
(Reading database ... 180240 files and directories currently installed.)
Preparing to unpack mysql-common_5.7.16-1ubuntu14.04_amd64.deb ...
Unpacking mysql-common (5.7.16-1ubuntu14.04) over (5.7.16-1ubuntu14.04) ...
Setting up mysql-common (5.7.16-1ubuntu14.04) ...
[email protected]:/usr/mysql#

在安裝libmysqlclient-dev_5.7.16-1ubuntu14.04_amd64.deb
libmysqlclient20_5.7.16-1ubuntu14.04_amd64.deb
libmysqld-dev_5.7.16-1ubuntu14.04_amd64.deb
注意安裝順序可能不一致

倒數第二步 安裝mysql 客戶端

[email protected]:/usr/mysql# dpkg -i mysql-client_5.7.16-1ubuntu14.04_amd64.deb       
(Reading database ... 180240 files and directories currently installed.)
Preparing to unpack mysql-client_5.7.16-1ubuntu14.04_amd64.deb ...
Unpacking mysql-client (5.7.16-1ubuntu14.04) over (5.7.16-1ubuntu14.04) ...
Setting up mysql-client (5.7.16-1ubuntu14.04) ...
[email protected]:/usr/mysql#

檢視mysql客戶端版本

root@ubuntu:/usr/mysql# mysql --version
mysql  Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using  EditLine wrapper
root@ubuntu:/usr/mysql#

通過mysql客戶端訪問mysql遠端服務。在這裡訪問我的Windows上的mysql服務。首先啟動Windows mysql 服務

C:\Users\Administrator>net start mysql
MySQL 服務正在啟動 ...
MySQL 服務已經啟動成功。
[email protected]:/usr/mysql# mysql -u root -h 192.168.10.114 -p -P 3306
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.17-log MySQL Community Server (GPL)

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

成功
注意:遠端登陸伺服器可能報許可權不足錯誤:SQLException: access denied for @’192.168.10.114’ (using password: yes)
解決辦法 本地登陸mysql伺服器更改許可權 執行

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.10.114' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 

ON 後面的*.* 表示所有的資料庫下所有的資料表 ,TO 後面的root表示使用者名稱為root, @後的引數表示遠端登陸機器的ip,%表示所有遠端機器都可登陸,BY後面的引數表示遠端登陸機器的密碼

上面這個程式碼的含義是 允許 遠端機器ip為192.168.10.114的機器訪問這臺mysql伺服器 ,使用者名稱為 ‘root’ 密碼為‘mypassword’

最後一步:安裝mysql服務 mysql-server_5.7.16-1ubuntu14.04_amd64.deb

[email protected]:/usr/mysql# dpkg -i mysql-server_5.7.16-1ubuntu14.04_amd64.deb 
(Reading database ... 180240 files and directories currently installed.)
Preparing to unpack mysql-server_5.7.16-1ubuntu14.04_amd64.deb ...
Unpacking mysql-server (5.7.16-1ubuntu14.04) over (5.7.16-1ubuntu14.04) ...
Setting up mysql-server (5.7.16-1ubuntu14.04) ...
[email protected]:/usr/mysql# 

安裝過程中 會出現要你填寫 使用者名稱和密碼的視窗,由於我之前安裝過,在這裡顯示不了。
完成之後就可以訪問你本地的mysql服務了

先開啟本機mysql服務 mysql 伺服器安裝在/etc/init.d/目錄下 mysql客戶端安裝在 /usr/bin/目錄下

root@ubuntu:/usr/mysql# /etc/init.d/mysql start
.....
 * MySQL Community Server 5.7.16 is started
root@ubuntu:/usr/mysql# 

本地訪問

[email protected]:/usr/mysql# mysql -u root -h localhost -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.16 MySQL Community Server (GPL)

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

成功!
注意mysql的配置檔案在/etc/mysql 目錄下包括客戶端和伺服器的配置檔案
更改mysqld.cnf(伺服器配置檔案)

[email protected]:/# vim /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address   = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

將bind-address註釋掉儲存 退出
重啟mysql 服務

[email protected]:/etc/mysql# /etc/init.d/mysql restart
 * Stopping MySQL Community Server 5.7.16
...
 * MySQL Community Server 5.7.16 is stopped
 * Re-starting MySQL Community Server 5.7.16
...
 * MySQL Community Server 5.7.16 is started
[email protected]:/etc/mysql# 

注意重新啟動mysql服務需要用mysql服務的絕對路徑。

登陸 mysql 伺服器 給遠端機器授權

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 

這時 遠端機器就能訪問這臺mysql伺服器了
不同的機器 不同的版本安裝mysql都不太相同,下面介紹通過原始碼包安裝mysql 服務

相關推薦

ubuntu14.04安裝mysql服務

[email protected]:/usr/mysql# tar -xf mysql-server_5.7.16-1ubuntu14.04_amd64.deb-bundle.tar [email protected]:/usr/m

ubuntu14.04 安裝mysql 失敗經歷(Access denied for user 'root'@'localhost' (using password: YES))

# mysql -uroot -p  輸入密碼: -----》Access denied for user 'root'@'localhost' (using password: YES)   # cat /etc/mysql/debian.cnf [clie

ubuntu14.04安裝mysql-workbench

為了在ubuntu14.04上安裝畫ER圖的軟體,在網上搜了一下,很少有人推薦在windows上用的powerdesigner,推薦說用mysql-workbench就可以。所以就安裝了mysql-workbench用來畫ER圖,安裝過程超級簡單。具體如下:

ubuntu14.04下ldap服務和客服端安裝,配置

LDAP是一個輕量級目錄管理系統。可以統一管理賬號。對資料的讀取速度快,儲存資料的能力慢。 LADP有server和client端。 安裝環境: ldap server和 ldap client分別安裝在兩臺ubuntu14.04上(虛擬機器上)。 一:ldap服務機的

Ubuntu14.04安裝遠端桌面服務

安裝x11vnc總是得到黑螢幕,一直無法解決。所以試試遠端桌面RDP連線。 1 Install the VNC Remote Desktop Server software sudo apt-get install xrdp 2 安裝Xfce4。

VMVare9.2, Ubuntu14.04安裝VMWare Tools找不到頭文件

generated baidu include change files VMVare9.2, Ubuntu14.04安裝VMWare Tools遇到一點問題,提示找不到內核頭文件,於是baidu之,作如下總結。首先執行:sudo apt-get install build-essenti

ubuntu14.04 安裝LNMP

data- http n) libcurl libmysql nbsp tar medium without 新書上市《深入解析Android 5.0系統》 通常我們使用centos來組建LNMP,可是我們開發時多使用ubuntu的桌面版本號來調試,以下將具體介紹怎

Ubuntu14.04安裝和配置ROS Indigo

lis des 運行 tps all href 使用 軟件源 sim Ubuntu安裝ROS教程 1、配置Ubuntu的軟件源 配置Ubuntu要求允許接受restricted、universe和multiverse的軟件源,可以根據下面的鏈接配置: https://h

MySQL學習筆記01安裝MySQL服務器軟件

unit mysq ubuntu sudo sql 準備 安裝 tar 啟動 1.1. 默認安裝 以mysql community server 5.7.19為例,安裝步驟如下: (1)安裝libaio。版本必須大於或等於這個版本。 libaio1_0.3.109-4_

Ubuntu16.04 安裝mysql

lis nbsp get 使用 png 需要 提示 數據 mysq Ubuntu上安裝MySQL非常簡單只需要幾條命令就可以完成。 1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client

ubuntu 14.04安裝mysql-python

而是 n-1 targe clas ted 直接 ubun class blog 網上看到的是想安裝mysql-python都得安裝mysql本身,可是我就不想安裝這個數據庫,而是用於連接到別的服務器上的mysql,所以下面就是安裝過程: 1. 直接運行: pip in

MAC上安裝mysql服務

mac 安裝 mysql 1、下載mysql 訪問MySQL的官網http://www.mysql.com/downloads/ 然後在頁面中會看到“MySQL Community Server”下方有一個“download”點擊。 進入MySQL的下載界面(http://

Ubuntu14.04安裝PyMuPDF

找到 build amp imp ade git correct jpeg rec 最近寫的一個東西需要將pdf轉成圖片然後放在網頁上展示,找到了個非常好用的輪子叫做PyMuPDF,在windows上測試的時候跑的666,在ubuntu上安裝依賴的時候,簡直萬臉懵逼。git

Ubuntu14.04安裝opencv3.1和opencv3.3

-c user com hub http asp 文件重命名 參考 log 視覺SLAM十四講用到了opencv3.1,而opencv3.3增加了深度學習方面的應用,因此,編譯二者用於下一步的學習和研究。 1.安裝opencv3.1 安裝參考鏈接:https://docs.

ubuntu 16.04安裝mysql

family 命令 wid col -s tty pro ret space 首先執行下面三條命令: sudo apt-get install mysql-server sudo apt install mysql-client sudo apt install libmy

ubuntu14.04安裝tun/tap網絡設備

margin 編譯 ges 完成 解決辦法 dir libssl rest ubun 14.04的系統默認是沒有tun設備的,所以需要通過在內核中編譯時勾選此設備。接下來分步來介紹如何安裝tun設備。 一、更新ubuntu桌面版源: sudo gedit /etc/apt

使用docker安裝mysql服務

note mysq 端口 www. 密碼 mys sql 服務 .html 轉載:https://www.cnblogs.com/notejava/p/7124189.html 使用docker官方鏡像安裝mysql服務 1 拉取mysql鏡像,采用網易加速地址dock

Ubuntu14.04安裝libusb

pro 依賴 找不到 not erro make cef 訪問 找到 libuvc是一個跨平臺的USB視頻設備庫,建立在libusb之上。 它能夠對導出標準USB視頻類(UVC)接口的USB視頻設備進行細化控制,使開發人員能夠為以前不支持的設備編寫驅動程序,或者以通用的方式

ubuntu16.04安裝ssh服務,並實現遠程訪問

openss config 成功 serve 配置 install sshd ubun 遠程 一、查看是否安裝了ssh服務 apt-cache policy openssh-client openssh-server ubuntu默認安裝了openssh-client,op

ubuntu14.04安裝python3.6和pip9.0.1

系統 efi 歐洲 clas 折騰 span 解壓縮 pytho col 前提: ubuntu14.04自帶python2.7和python3.4,如下: 要想安裝python3.6,建議不要動之前的2.7和3.6(血一般的教訓) 下面我們切入正題: 安裝python3