溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

Mysql安裝過(guò)程是怎樣的

發(fā)布時(shí)間:2021-09-28 11:45:10 來(lái)源:億速云 閱讀:128 作者:柒染 欄目:MySQL數(shù)據(jù)庫(kù)

這篇文章給大家介紹Mysql安裝過(guò)程,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

環(huán)境說(shuō)明:
操作系統(tǒng):Red Hat Linux 6
安裝Mysql5.7版本

安裝須知:
一、準(zhǔn)備mysql的安裝包
二、準(zhǔn)備好安裝環(huán)境

操作指導(dǎo):
一、下載mysql的安裝包
https://www.mysql.com/downloads/ 訪問(wèn)mysql下載地址,進(jìn)行如下操作進(jìn)行下載。

Mysql安裝過(guò)程是怎樣的

Mysql安裝過(guò)程是怎樣的

Mysql安裝過(guò)程是怎樣的

Mysql安裝過(guò)程是怎樣的

將下載好的mysql安裝包放到自己建立的安裝目錄下,進(jìn)行解壓。

[root@root /]# cd /soft/
[root@root soft]# ll
總用量 1151432
-rw-r--r--. 1 root root  227512320 8月   7 17:59 MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar
-rw-r--r--. 1 root root  475770880 8月   7 18:21 mysql-5.7.23-1.el6.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415  24024136 6月  11 11:21 mysql-community-client-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415    340072 6月  11 11:21 mysql-community-common-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   3736628 6月  11 11:21 mysql-community-devel-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415  39496088 6月  11 11:21 mysql-community-embedded-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 137638820 6月  11 11:21 mysql-community-embedded-devel-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   2192692 6月  11 11:21 mysql-community-libs-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   1723712 6月  11 11:21 mysql-community-libs-compat-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 160480880 6月  11 11:21 mysql-community-server-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 106124936 6月  11 11:21 mysql-community-test-5.7.23-1.el6.x86_64.rpm

二、準(zhǔn)備好安裝環(huán)境
檢查當(dāng)前系統(tǒng)下是否有mysql服務(wù),方法: rpm -qa | grep mysql。 如果有就用rpm卸載掉??梢允褂玫拿钍?rpm -ev 程序(如果卸載報(bào)存在依賴(lài)關(guān)系問(wèn)題就用,rpm -e --nodeps 程序 進(jìn)行卸載, --nodeps 跳過(guò)依賴(lài)關(guān)系)

[root@root mysql]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
root@root mysql]# rpm -ev mysql-libs-5.1.71-1.el6.x86_64  /*報(bào)依賴(lài)關(guān)系*/
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
[root@root soft]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64  /*卸載不含依賴(lài)關(guān)系*/
[root@root soft]#

三、進(jìn)行mysql服務(wù)安裝
進(jìn)入到mysql包的解壓目錄下,用rpm進(jìn)行安裝。注意安裝順序,否則或報(bào)依賴(lài)關(guān)系錯(cuò)誤。

[root@root soft]# rpm -ivh mysql-community-common-5.7.23-1.el6.x86_64.rpm
[root@root soft]# rpm -ivh mysql-community-libs-5.7.23-1.el6.x86_64.rpm
[root@root soft]# rpm -ivh mysql-community-client-5.7.23-1.el6.x86_64.rpm
[root@root soft]# rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm

安裝完成,修改配置文件。在/etc/my.cnf

[root@root etc]# vim my.cnf
[mysqld]
skip-grant-tables  /*添加,作用可以不用密碼進(jìn)行登錄*/

啟動(dòng)mysql服務(wù),輸入mysql就可以進(jìn)入數(shù)據(jù)庫(kù)。(啟用成功可以用 netstat -nlap | grep mysql  查看mysql服務(wù))

[root@root soft]# service mysqld start
[root@root soft]# mysql  
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.7.23 MySQL Community Server (GPL)

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

這時(shí),你可以使用navicat工具連接mysql服務(wù)了。如果連接不上,請(qǐng)檢查3306端口是否開(kāi)發(fā),可以嘗試關(guān)閉linux防火墻。service iptables stop

嘗試連接成功后,我們可以為mysql服務(wù)設(shè)置密碼。
先選擇用戶(hù)

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> update user set authentication_string = password('111111'), password_expired = 'N', password_last_changed = now() where user = 'root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
mysql> flush privileges; /*刷入配置,必須執(zhí)行,否則后期錯(cuò)誤信息*/
Query OK, 0 rows affected (0.00 sec)
mysql>

注:這個(gè)設(shè)置密碼方式如果不對(duì),可以嘗試其它方法設(shè)置密碼(如:mysqladmin -u root password “11111111”)。設(shè)置完密碼切記要去my.cnf配置文件把skip-grant-tables 注釋掉,在重啟mysql服務(wù)。這是就可使用用戶(hù)名密碼登錄。

關(guān)于Mysql安裝過(guò)程就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI