成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

CentOS7如何安裝mysql5.7解壓縮版-創(chuàng)新互聯(lián)

這篇文章給大家分享的是有關(guān)CentOS7如何安裝mysql5.7解壓縮版的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

壺關(guān)網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),壺關(guān)網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為壺關(guān)近千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的壺關(guān)做網(wǎng)站的公司定做!

1.下載安裝包

http://dev.mysql.com/downloads/mysql/#downloads

2.檢查庫文件是否存在,如有刪除。

[root@localhost Desktop]$ rpm -qa | grep mysql
mysql-libs-5.1.52-1.el6_0.1.x86_64
[root@localhost ~]$ rpm -e mysql-libs-5.1.52.x86_64 --nodeps
[root@localhost ~]$

3.檢查mysql組和用戶是否存在,如無創(chuàng)建。

[root@localhost ~]$ cat /etc/group | grep mysql
mysql:x:490:
[root@localhost ~]$ cat /etc/passwd | grep mysql
mysql:x:496:490::/home/mysql:/bin/bash
以上為默認存在的情況,如無,執(zhí)行添加命令:
[root@localhost ~]$groupadd mysql
[root@localhost ~]$useradd -r -g mysql mysql
//useradd -r參數(shù)表示mysql用戶是系統(tǒng)用戶,不可用于登錄系統(tǒng)。

4.解壓TAR包,更改所屬的組和用戶

[root@localhost ~]$ cd /usr/local/
[root@localhost local]$ tar xvf mysql-5.7.12-linux-glibc2.5-x86_64.tar
[root@localhost local]$ ls -l
total 1306432
-rwxr--r--. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar
-rw-r--r--. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz
[root@localhost local]$ tar xvfz mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
[root@localhost local]$ mv mysql-5.7.12-linux-glibc2.5-x86_64 mysql
[root@localhost local]$ ls -l
total 1306436
drwxr-xr-x. 2 root root    4096 Dec 4 2009 bin
drwxr-xr-x. 2 root root    4096 Dec 4 2009 etc
drwxr-xr-x. 2 root root    4096 Dec 4 2009 games
drwxr-xr-x. 2 root root    4096 Dec 4 2009 include
drwxr-xr-x. 2 root root    4096 Dec 4 2009 lib
drwxr-xr-x. 3 root root    4096 Dec 2 14:36 lib64
drwxr-xr-x. 2 root root    4096 Dec 4 2009 libexec
drwxr-xr-x. 9 7161 wheel   4096 Mar 28 12:51 mysql
-rwxr--r--. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar
-rw-r--r--. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz
drwxr-xr-x. 2 root root    4096 Dec 4 2009 sbin
drwxr-xr-x. 6 root root    4096 Dec 2 14:36 share
drwxr-xr-x. 2 root root    4096 Dec 4 2009 src
[root@localhost local]$ chown -R mysql mysql/
[root@localhost local]$ chgrp -R mysql mysql/
[root@localhost local]$ cd mysql/

5.安裝和初始化數(shù)據(jù)庫

[root@localhost mysql]$ bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
2016-06-01 15:23:25 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2016-06-01 15:23:30 [WARNING] The bootstrap log isn't empty:
2016-06-01 15:23:30 [WARNING] 2016-06-01T22:23:25.491840Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
2016-06-01T22:23:25.492256Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-06-01T22:23:25.492260Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

如果改變默認安裝路徑,則需要  1)/etc/my.cnf、/etc/init.d/mysqld中修改  basedir='/apps/mysql'  datadir='/apps/mysql/data'  2)創(chuàng)建ln  mkdir -p /usr/local/mysql/bin  ln -s /apps/mysql/bin/mysqld /usr/local/mysql/bin/mysqld

[root@localhost mysql]$
[root@localhost mysql]$ cp -a ./support-files/my-default.cnf /etc/my.cnf
[root@localhost mysql]$ cp -a ./support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql]$ cd bin/
[root@localhost bin]# ./mysqld_safe --user=mysql &
[1] 2932
[root@localhost bin]# 2016-06-01T22:27:09.708557Z mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
2016-06-01T22:27:09.854913Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@localhost bin]# /etc/init.d/mysqld restart
Shutting down MySQL..2016-06-01T22:27:50.498694Z mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended
 SUCCESS!
Starting MySQL. SUCCESS!
[1]+ Done          ./mysqld_safe --user=mysql
[root@localhost bin]$
//設(shè)置開機啟動
[root@localhost bin]$ chkconfig --level 35 mysqld on
[root@localhost bin]$

6.初始化密碼

mysql5.7會生成一個初始化密碼,而在之前的版本首次登陸不需要登錄。

[root@localhost bin]$ cat /root/.mysql_secret
# Password set for user 'root@localhost' at 2016-06-01 15:23:25
,xxxxxR5H9
[root@localhost bin]$./mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12
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> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

7.添加遠程訪問權(quán)限

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 host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host, user from user;
+-----------+-----------+
| host   | user   |
+-----------+-----------+
| %     | root   |
| localhost | mysql.sys |
+-----------+-----------+
//一定要重啟才會生效。
/etc/init.d/mysqld restart

遇到的問題:

找不到mysql.sock,mysql.sock丟失問題解決方法

連接Mysql時,機器上找不到mysql.sock文件你可以簡單地通過重啟服務(wù)器重新創(chuàng)建得到它。因為服務(wù)器在啟動時重新創(chuàng)建它。

[root@localhost mysql-5.7.13]# ./bin/mysql_install_db --user=mysql
2016-06-26 02:47:09 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2016-06-26 02:47:09 [ERROR]  The data directory needs to be specified.

解決:需要新建data目錄,指定安裝目錄(在非默認目錄時需要指定,默認路徑:/usr/local/mysql,同時需要指定./support-files/mysql.server中的basedir和datadir為相應(yīng)路徑)。

[root@localhost mysql-5.7.13]# ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.7.13/ --datadir=/usr/local/mysql-5.7.13/data/
2016-06-26 02:48:47 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2016-06-26 02:49:19 [WARNING] The bootstrap log isn't empty:
2016-06-26 02:49:19 [WARNING] 2016-06-26T09:48:50.798592Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
2016-06-26T09:48:50.898732Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-06-26T09:48:50.898778Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

以上報錯均因未在mysql.server中指定自定義的路徑。

若是還提示已經(jīng)有data文件了 刪除了它,新建即可

感謝各位的閱讀!關(guān)于“CentOS7如何安裝mysql5.7解壓縮版”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

當前文章:CentOS7如何安裝mysql5.7解壓縮版-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://jinyejixie.com/article18/dsepgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站定制開發(fā)、電子商務(wù)App開發(fā)、網(wǎng)站收錄App設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司
永吉县| 皋兰县| 兴化市| 彰化县| 淄博市| 邢台县| 沈阳市| 伊宁市| 苏尼特左旗| 九江县| 宜兴市| 桃园县| 平顶山市| 许昌县| 象山县| 北辰区| 叙永县| 静安区| 安乡县| 吉木萨尔县| 略阳县| 怀来县| 南雄市| 云龙县| 鄂托克旗| 贞丰县| 容城县| 柳河县| 莱州市| 安乡县| 安福县| 安陆市| 灌阳县| 石棉县| 麻城市| 咸宁市| 通化县| 甘洛县| 云南省| 清水河县| 应用必备|