欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CentOS7安裝mysql5.7解壓縮版簡(jiǎn)明教程

 更新時(shí)間:2018年03月19日 10:13:14   作者:zl_shitou  
這篇文章主要介紹了CentOS7安裝mysql5.7解壓縮版,簡(jiǎn)單介紹了CentOS7環(huán)境下的mysql5.7壓縮版下載、解壓、安裝、配置、密碼設(shè)置等相關(guān)命令及操作技巧,需要的朋友可以參考下

本文實(shí)例講述了CentOS7安裝mysql5.7解壓縮版的方法。分享給大家供大家參考,具體如下:

1.下載安裝包

http://dev.mysql.com/downloads/mysql/#downloads
推薦下載通用安裝方法的TAR包

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

[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組和用戶是否存在,如無(wú)創(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
以上為默認(rèn)存在的情況,如無(wú),執(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ù)庫(kù)

[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)

如果改變默認(rèn)安裝路徑,則需要  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è)置開(kāi)機(jī)啟動(dòng)
[root@localhost bin]$ chkconfig --level 35 mysqld on
[root@localhost bin]$

6.初始化密碼

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

[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.添加遠(yuǎn)程訪問(wèn)權(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 |
+-----------+-----------+
//一定要重啟才會(huì)生效。
/etc/init.d/mysqld restart

遇到的問(wèn)題:

找不到mysql.sock,mysql.sock丟失問(wèn)題解決方法

連接Mysql時(shí),機(jī)器上找不到mysql.sock文件你可以簡(jiǎn)單地通過(guò)重啟服務(wù)器重新創(chuàng)建得到它。因?yàn)榉?wù)器在啟動(dòng)時(shí)重新創(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目錄,指定安裝目錄(在非默認(rèn)目錄時(shí)需要指定,默認(rèn)路徑:/usr/local/mysql,同時(shí)需要指定./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)

以上報(bào)錯(cuò)均因未在mysql.server中指定自定義的路徑。

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

希望本文所述對(duì)大家CentOS服務(wù)器維護(hù)有所幫助。

相關(guān)文章

  • 解決VScode配置遠(yuǎn)程調(diào)試Linux程序的問(wèn)題

    解決VScode配置遠(yuǎn)程調(diào)試Linux程序的問(wèn)題

    這篇文章主要介紹了VScode配置遠(yuǎn)程調(diào)試Linux程序及問(wèn)題解決辦法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-08-08
  • ssh連接超時(shí)解決方法

    ssh連接超時(shí)解決方法

    本文為大家介紹了ssh連接超時(shí)的解決方法, 另外提供一種不修改配置文件就可以解決連接超時(shí)的方法,大家參考使用吧
    2014-01-01
  • springcloud alibaba nacos linux配置的詳細(xì)教程

    springcloud alibaba nacos linux配置的詳細(xì)教程

    這篇文章主要介紹了springcloud alibaba nacos linux配置,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-10-10
  • apache集成php5.6方法分享

    apache集成php5.6方法分享

    這篇文章主要介紹了apache集成php5.6方法分享,需要的朋友可以參考下
    2015-01-01
  • Kerberos安裝教程及使用詳解

    Kerberos安裝教程及使用詳解

    Kerberos協(xié)議主要用于計(jì)算機(jī)網(wǎng)絡(luò)的身份鑒別(Authentication), 其特點(diǎn)是用戶只需輸入一次身份驗(yàn)證信息就可以憑借此驗(yàn)證獲得的票據(jù)(ticket-granting ticket)訪問(wèn)多個(gè)服務(wù)。這篇文章主要介紹了Kerberos安裝教程及使用詳解的相關(guān)資料,需要的朋友可以參考下
    2016-10-10
  • 淺談Linux配置定時(shí),使用crontab -e與直接編輯/etc/crontab的區(qū)別

    淺談Linux配置定時(shí),使用crontab -e與直接編輯/etc/crontab的區(qū)別

    下面小編就為大家?guī)?lái)一篇淺談Linux配置定時(shí),使用crontab -e與直接編輯/etc/crontab的區(qū)別。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-11-11
  • 簡(jiǎn)要分析linux系統(tǒng)的啟動(dòng)過(guò)程

    簡(jiǎn)要分析linux系統(tǒng)的啟動(dòng)過(guò)程

    接觸linux系統(tǒng)運(yùn)維已經(jīng)好幾年了,常常被問(wèn)到linux系統(tǒng)啟動(dòng)流程問(wèn)題,這篇文章主要介紹了簡(jiǎn)要分析linux系統(tǒng)的啟動(dòng)過(guò)程,需要的朋友可以參考下
    2018-08-08
  • centos更改時(shí)區(qū)的方法

    centos更改時(shí)區(qū)的方法

    centos默認(rèn)使用UTC時(shí)區(qū),中國(guó)用戶需要修改成自己的時(shí)區(qū),這篇文章主要介紹了centos更改時(shí)區(qū)的方法,需要的朋友可以參考下
    2014-03-03
  • Ubuntu16.04.5LTS安裝SVN的過(guò)程

    Ubuntu16.04.5LTS安裝SVN的過(guò)程

    這篇文章主要介紹了Ubuntu16.04.5LTS安裝SVN的過(guò)程,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-12-12
  • 如何給Linux虛擬機(jī)連上WiFi詳解

    如何給Linux虛擬機(jī)連上WiFi詳解

    這篇文章主要介紹了如何給Linux虛擬機(jī)連上WiFi,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04

最新評(píng)論