centos 6.5下 mysql-community-server. 5.7.18-1.el6安裝

来源:http://www.cnblogs.com/dingdangzhijia/archive/2017/04/27/6773056.html
-Advertisement-
Play Games

使用下麵的命令檢查是否安裝有MySQL Server 有的話,我們就通過 rpm -e 命令 或者 rpm -e --nodeps 命令來卸載掉 在刪除完以後我們可以通過 rpm -qa | grep mysql 命令來查看mysql是否已經卸載成功!! 官網yum repository 下載安裝包 ...


   使用下麵的命令檢查是否安裝有MySQL Server

[root@localhost etc]# rpm -qa | grep mysql  // 這個命令就會查看該操作系統上是否已經安裝了mysql資料庫

   有的話,我們就通過 rpm -e 命令 或者 rpm -e --nodeps 命令來卸載掉

[root@localhost ~]# rpm -e mysql  // 普通刪除模式
[root@localhost ~]# rpm -e --nodeps mysql  // 強力刪除模式,如果使用上面命令刪除時,提示有依賴的其它文件,則用該命令可以對其進行強力刪除

   在刪除完以後我們可以通過 rpm -qa | grep mysql 命令來查看mysql是否已經卸載成功!!

官網yum repository 下載安裝包

[root@localhost ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm

 

--2017-04-24 18:53:49--  http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm
Resolving dev.mysql.com... 137.254.60.11
Connecting to dev.mysql.com|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm [following]
--2017-04-24 18:53:49--  https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm
Connecting to dev.mysql.com|137.254.60.11|:443... connected.
ERROR: certificate common name “www.mysql.com” doesn’t match requested host name “dev.mysql.com”.
To connect to dev.mysql.com insecurely, use ‘--no-check-certificate’

  

本地安裝下載下來的rpm包

[root@localhost ~]# yum localinstall mysql57-community-release-el6-10.noarch.rpm

  

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Local Package Process
Examining mysql57-community-release-el6-10.noarch.rpm: mysql57-community-release-el6-10.noarch
Marking mysql57-community-release-el6-10.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el6-10 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                            Arch                            Version                            Repository                                                         Size
===============================================================================================================================================================================================
Installing:
 mysql57-community-release                          noarch                          el6-10                             /mysql57-community-release-el6-10.noarch                           30 k

Transaction Summary
===============================================================================================================================================================================================
Install       1 Package(s)

Total size: 30 k
Installed size: 30 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql57-community-release-el6-10.noarch                                                                                                                                     1/1 
  Verifying  : mysql57-community-release-el6-10.noarch                                                                                                                                     1/1 

Installed:
  mysql57-community-release.noarch 0:el6-10                                                                                                                                                    

Complete!

  查看可用的安裝包

[root@localhost ~]# yum repolist enabled|grep mysql
mysql-connectors-community           MySQL Connectors Community              33
mysql-tools-community                MySQL Tools Community                   47
mysql57-community                    MySQL 5.7 Community Server             183

  

安裝前裝gcc所有包,防止報錯[Errno -1]  Package does not match intended download

[root@localhost yum.repos.d]# yum install gcc*

  

安裝mysql

[root@localhost yum.repos.d]# yum install -y  mysql-community-server

  

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.18-1.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.18-1.el6 for package: mysql-community-server-5.7.18-1.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.18-1.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.7.18-1.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.18-1.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.18-1.el6 will be obsoleting
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated
---> Package postfix.x86_64 2:2.6.6-8.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                                 Arch               Version                      Repository                     Size
=============================================================================================================================
Installing:
 mysql-community-libs                    x86_64             5.7.18-1.el6                 mysql57-community             2.1 M
     replacing  mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-libs-compat             x86_64             5.7.18-1.el6                 mysql57-community             1.6 M
     replacing  mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-server                  x86_64             5.7.18-1.el6                 mysql57-community             152 M
Installing for dependencies:
 mysql-community-client                  x86_64             5.7.18-1.el6                 mysql57-community              23 M
 mysql-community-common                  x86_64             5.7.18-1.el6                 mysql57-community             328 k
Updating for dependencies:
 postfix                                 x86_64             2:2.6.6-8.el6                base                          2.0 M

Transaction Summary
=============================================================================================================================
Install       5 Package(s)
Upgrade       1 Package(s)

Total size: 180 M
Total download size: 152 M
Downloading Packages:
mysql-community-server-5.7.18-1.el6.x86_64.rpm                                                        | 152 MB     01:41     
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid : MySQL Release Engineering <[email protected]>
 Package: mysql57-community-release-el6-10.noarch (@/mysql57-community-release-el6-10.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-community-common-5.7.18-1.el6.x86_64                                                                1/8 
  Installing : mysql-community-libs-5.7.18-1.el6.x86_64                                                                  2/8 
  Installing : mysql-community-libs-compat-5.7.18-1.el6.x86_64                                                           3/8 
  Installing : mysql-community-client-5.7.18-1.el6.x86_64                                                                4/8 
  Installing : mysql-community-server-5.7.18-1.el6.x86_64                                                                5/8 
  Updating   : 2:postfix-2.6.6-8.el6.x86_64                                                                              6/8 
  Cleanup    : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                          7/8 
  Erasing    : mysql-libs-5.1.71-1.el6.x86_64                                                                            8/8 
  Verifying  : 2:postfix-2.6.6-8.el6.x86_64                                                                              1/8 
  Verifying  : mysql-community-libs-compat-5.7.18-1.el6.x86_64                                                           2/8 
  Verifying  : mysql-community-server-5.7.18-1.el6.x86_64                                                                3/8 
  Verifying  : mysql-community-libs-5.7.18-1.el6.x86_64                                                                  4/8 
  Verifying  : mysql-community-common-5.7.18-1.el6.x86_64                                                                5/8 
  Verifying  : mysql-community-client-5.7.18-1.el6.x86_64                                                                6/8 
  Verifying  : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                          7/8 
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                                                                            8/8 

Installed:
  mysql-community-libs.x86_64 0:5.7.18-1.el6                 mysql-community-libs-compat.x86_64 0:5.7.18-1.el6              
  mysql-community-server.x86_64 0:5.7.18-1.el6              

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.18-1.el6                  mysql-community-common.x86_64 0:5.7.18-1.el6                 

Dependency Updated:
  postfix.x86_64 2:2.6.6-8.el6                                                                                               

Replaced:
  mysql-libs.x86_64 0:5.1.71-1.el6                                                                                           

Complete!

 

啟動mysql

[root@localhost yum.repos.d]# service mysqld start

  

Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]

  進入mysql安全模式

[root@localhost yum.repos.d]# killall -TERM mysqld
[root@localhost yum.repos.d]# mysqld_safe --skip-grant-tables & 
[1] 40422
[root@localhost yum.repos.d]# 2017-04-25T07:45:39.222061Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-04-25T07:45:39.246117Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from users;
ERROR 1146 (42S02): Table 'mysql.users' doesn't exist
mysql> select * from user;

mysql> update user set authentication_string=PASSWORD('mysql') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> quit
Bye
[2]+  Exit 1                  mysqld_safe --skip-grant-tables

  

 

[root@localhost yum.repos.d]# service mysqld start
Starting mysqld:                                           [  OK  ]
[root@localhost yum.repos.d]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18 MySQL Community Server (GPL)

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 -h主機地址 -u用戶名 -p用戶密碼
1、例1:連接到本機上的MYSQL

 

   找到mysql的安裝目錄,一般可以直接鍵入命令mysql -uroot -p,回車後提示你輸密碼,如果剛安裝好MYSQL,超級用戶root是沒有密碼的,故直接回車即可進入到MYSQL中

了,MYSQL的提示符是:mysql>

 

2、連接到遠程主機上的MYSQL

 

   假設遠程主機的IP為:10.0.0.1,用戶名為root,密碼為123。則鍵入以下命令:

 

   mysql -h10.0.0.1 -uroot -p123

 

  (註:u與root可以不用加空格,其它也一樣)

 

配置防火牆
防火牆的3306埠預設沒有開啟,若要遠程訪問,需要開啟這個埠
打開/etc/sysconfig/iptables
在“-A INPUT –m state --state NEW –m tcp –p tcp –dport 22 –j ACCEPT”,下添加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
然後保存,並關閉該文件,在終端內運行下麵的命令,刷新防火牆配置:
service iptables restart OK,一切配置完畢,你可以訪問你的MySQL了~

註意:增加的開放3306埠的語句一定要在icmp-host-prohibited之前

  

 

 

 

 




mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

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.


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 公用表表達式簡介: 公用表表達式 (CTE) 可以認為是在單個 SELECT、INSERT、UPDATE、DELETE 或 CREATE VIEW 語句的執行範圍內定義的臨時結果集。CTE 與派生表類似,具體表現在不存儲為對象,並且只在查詢期間有效。與派生表的不同之處在於,公用表表達式 (CTE) ...
  • 資料庫恢復失敗,原來的數據卻變成了 當嘗試打開資料庫的屬性,即出現上面圖片異常的信息。正常來說,是可以打開資料庫的屬性 此刻,你可以運行SQL語句來解決: USE master; GO ALTER DATABASE [Tutorial] SET SINGLE_USER WITH ROLLBACK I ...
  • 用EXISTS替代IN用NOT EXISTS替代NOT IN用表連接[left、right、inner]查詢替換EXISTS ...
  • 沒有偶然的運氣,只有不斷的努力! There is no accidental luck, only constant efforts! 首先 新聞發佈會結合了JSP里的Servlet和request對象,response對象還有使用session對象和cookie對象。 -登錄頁面 package ...
  • 【註】關閉window的防火牆 1. 安裝開發hadoop插件 將hadoop安裝包hadoop-eclipse-plugin-2.7.3拷貝到eclipse的插件目錄plugins下。 插件百度雲地址:http://pan.baidu.com/s/1dEXywz3 重啟eclipse,打開wind ...
  • R + Hive = RHive 支持原創:http://blog.fens.me/nosql-r-hive/ R利劍NoSQL系列文章 之 Hive Hive介紹 Hive安裝 RHive安裝 RHive函數庫 RHive基本使用操作 1. Hive介紹 Hive是建立在Hadoop上的數據倉庫基 ...
  • 在使用JDBC連接mysql時可能會遇到以下錯誤: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to th ...
  • 1. 忘記root密碼編輯mysql主配置文件 my.cnf 在[mysqld]欄位下添加參數 skip-grant ,重啟資料庫服務,這樣就可以進入資料庫不用授權了 mysql -uroot ,修改相應用戶密碼 use mysql; update user set password=passwor ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...