最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ubuntu server配置mysql并實(shí)現(xiàn)遠(yuǎn)程連接的操作方法

 更新時(shí)間:2017年12月28日 09:44:38   作者:EricRae  
下面小編就為大家分享一篇ubuntu server配置mysql并實(shí)現(xiàn)遠(yuǎn)程連接的操作方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

服務(wù)器:ubuntu server 16.04 LSS

客戶(hù)機(jī):ubuntu 16.04 LTS

服務(wù)器配置

服務(wù)器安裝mysql

# eric @ userver in ~ [14:00:31] 
$ sudo apt install mysql-server install mysql-client libmysqlclient-dev

檢查是否成功SET PASSWORD FOR ‘pig'@'%' = PASSWORD(“123456”);

# eric @ userver in ~ [14:10:55] 
$ sudo netstat -tap | grep mysql
tcp 0 0 localhost:mysql *:* LISTEN 5287/mysqld  

修改遠(yuǎn)程連接配置文件

# eric @ userver in ~ [14:16:26] 
$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 
#注釋掉 bind-address   = 127.0.0.1
#bind-address   = 127.0.0.1

設(shè)置服務(wù)器數(shù)據(jù)庫(kù)字符為utf-8

# eric @ userver in ~ [14:16:26] 
$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 
#在[mysqld] 中添加:character-set-server=utf8
[mysqld]
#
# * Basic Settings
#
user   = mysql
pid-file  = /var/run/mysqld/mysqld.pid
socket   = /var/run/mysqld/mysqld.sock
port   = 3306
basedir   = /usr
datadir   = /var/lib/mysql
tmpdir   = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
character-set-server=utf8 #新增加

#登錄mysql查看字符

# eric @ userver in ~ [14:21:26]
$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, 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> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name   | Value      |
+--------------------------+----------------------------+
| character_set_client  | utf8      |
| character_set_connection | utf8      |
| character_set_database | utf8      |
| character_set_filesystem | binary      |
| character_set_results | utf8      |
| character_set_server  | utf8      |
| character_set_system  | utf8      |
| character_sets_dir  | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

新建遠(yuǎn)程登錄用戶(hù)并授權(quán)

mysql> create user 'eric'@'%' identified by 'lyd2017';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on *.* to 'eric'@'%';--所有權(quán)限
Query OK, 0 rows affected (0.00 sec)

關(guān)于授權(quán):

命令:GRANT privileges ON databasename.tablename TO 'username'@'host'

說(shuō)明:privileges-用戶(hù)的操作權(quán)限,如select,insert,update 等,如果要授予所有權(quán)則使用all

如果要授予該用戶(hù)對(duì)所有數(shù)據(jù)庫(kù)和表的操作權(quán)限則用* 表示,如 *.*

例如:

GRANT SELECT, INSERT ON mysql.tables TO 'eric'@'%';
GRANT ALL ON *.* TO 'eric'@'%';

但是用這些命令授權(quán)的用戶(hù)不能再給其他用戶(hù)授權(quán),如果要讓該用戶(hù)有權(quán)限,則使用

GRANT privileges ON databasename.tablename TO 'username'@'host' WITH GRANT OPTION;

重啟服務(wù)器

# eric @ userver in ~ [14:35:49] 
$ /etc/init.d/mysql restart 
[....] Restarting mysql (via systemctl): mysql.service==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'mysql.service'.
Authenticating as: eric,,, (eric)
Password: 
==== AUTHENTICATION COMPLETE ===

客戶(hù)端

安裝mysql客戶(hù)端

# eric @ ray in ~ [14:32:12] C:127
$ sudo apt install mysql-client
[sudo] password for eric: 
Reading package lists... Done

連接mysql服務(wù)器

# eric @ ray in ~ [14:37:13] C:1
$ mysql -h 192.168.122.58 -u eric -p #
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, 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>

關(guān)于直接用root用戶(hù)連接報(bào)錯(cuò)問(wèn)題

# eric @ ray in ~ [14:35:22] C:1
$ mysql -h 192.168.122.58 -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'192.168.122.1' (using password: YES)

#如果剛開(kāi)始,直接用root用戶(hù)登錄,則會(huì)報(bào)錯(cuò),可修改root密碼解決該問(wèn)題
mysql>SET PASSWORD FOR 'root'@'%' = PASSWORD("123456"); 

以上這篇ubuntu server配置mysql并實(shí)現(xiàn)遠(yuǎn)程連接的操作方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 如何用命令行進(jìn)入mysql具體操作步驟

    如何用命令行進(jìn)入mysql具體操作步驟

    逛論壇時(shí)無(wú)意發(fā)現(xiàn)有個(gè)伙計(jì)提出這樣的問(wèn)題,如何用命令行進(jìn)入mysql,搜集整理了一些特意貼出來(lái)與大家分享,感興趣的你可以參考下希望對(duì)你有所幫助
    2013-03-03
  • pymysql操作mysql數(shù)據(jù)庫(kù)的方法

    pymysql操作mysql數(shù)據(jù)庫(kù)的方法

    這篇文章主要介紹了pymysql簡(jiǎn)單操作mysql數(shù)據(jù)庫(kù)的方法,主要講的是一些基礎(chǔ)的pymysql操作mysql數(shù)據(jù)庫(kù)的方法,結(jié)合實(shí)例代碼給大家講解的非常詳細(xì),需要的朋友可以參考下
    2023-04-04
  • jdbc連接mysq之serverTimezone設(shè)定方式

    jdbc連接mysq之serverTimezone設(shè)定方式

    這篇文章主要介紹了jdbc連接mysq之serverTimezone設(shè)定方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • 在Mysql環(huán)境下對(duì)數(shù)據(jù)進(jìn)行增刪改查的操作方法

    在Mysql環(huán)境下對(duì)數(shù)據(jù)進(jìn)行增刪改查的操作方法

    本文介紹了在MySQL環(huán)境下對(duì)數(shù)據(jù)進(jìn)行增刪改查的基本操作,包括插入數(shù)據(jù)、修改數(shù)據(jù)、刪除數(shù)據(jù)、數(shù)據(jù)查詢(xún)(基本查詢(xún)、連接查詢(xún)、聚合函數(shù)查詢(xún)、子查詢(xún))等,并舉例說(shuō)明了每種操作的具體用法,感興趣的朋友跟隨小編一起看看吧
    2025-02-02
  • MySQL將一個(gè)字段中以逗號(hào)分隔的取出來(lái)形成新的字段實(shí)現(xiàn)

    MySQL將一個(gè)字段中以逗號(hào)分隔的取出來(lái)形成新的字段實(shí)現(xiàn)

    這篇文章主要介紹了MySQL將一個(gè)字段中以逗號(hào)分隔的取出來(lái)形成新的字段實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • MySQL大內(nèi)存配置方案 如my-medium.ini、my-huge.ini等

    MySQL大內(nèi)存配置方案 如my-medium.ini、my-huge.ini等

    這篇文章主要介紹了MySQL大內(nèi)存配置方案 如my-medium.ini、my-huge.ini等,經(jīng)測(cè)試確實(shí)不錯(cuò),訪問(wèn)mysql速度快了很多
    2014-08-08
  • MySQL 8.0.12的安裝與卸載教程詳解

    MySQL 8.0.12的安裝與卸載教程詳解

    這篇文章主要介紹了MySQL 8.0.12的安裝與卸載的教程,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-12-12
  • 基于mysql 默認(rèn)排序規(guī)則的坑

    基于mysql 默認(rèn)排序規(guī)則的坑

    這篇文章主要介紹了解決mysql 默認(rèn)排序規(guī)則的坑,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看不看
    2021-02-02
  • 解決Windows安裝mysql時(shí)提示MSVCR120.DLL動(dòng)態(tài)庫(kù)缺失問(wèn)題

    解決Windows安裝mysql時(shí)提示MSVCR120.DLL動(dòng)態(tài)庫(kù)缺失問(wèn)題

    在Windows Server 2012系統(tǒng)上安裝MySQL 5.7時(shí)遇到“由于找不到MSVCR120.dll,無(wú)法繼續(xù)執(zhí)行代碼”的錯(cuò)誤,原因是系統(tǒng)缺少部分配置文件,解決方法是下載并安裝vcredist文件
    2025-02-02
  • 輕松解決MySQL忘記密碼如何重置的方法

    輕松解決MySQL忘記密碼如何重置的方法

    這篇文章主要為大家介紹了MySQL忘記密碼如何重置的方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2024-01-01

最新評(píng)論

玛沁县| 罗甸县| 共和县| 康平县| 新乡市| 临沂市| 延津县| 湖南省| 科尔| 汽车| 玛多县| 宁南县| 洪雅县| 乡城县| 乐山市| 平舆县| 桦川县| 肃宁县| 兴义市| 邵东县| 海林市| 榆中县| 罗甸县| 固镇县| 天镇县| 永顺县| 土默特右旗| 长寿区| 巴林右旗| 永登县| 磐安县| 北京市| 饶平县| 泽州县| 枝江市| 轮台县| 连城县| 保定市| 保靖县| 明星| 突泉县|