1. 程式人生 > >linux 下安裝解壓tar.gz 方式安裝mysql5.7版

linux 下安裝解壓tar.gz 方式安裝mysql5.7版

檢查之前是否解除安裝乾淨mysql,參考之前的一篇部落格

1.下載安裝檔案

[[email protected] tmp]# wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

2.解壓安裝包並重命名

[[email protected] tmp]# tar -xzvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[[email protected] local]# mv mysql-5.7.23-linux-glibc2.12-x86_64 mysql

3.在/user/local/mysql下建立data目錄

[[email protected] mysql]# mkdir data

4.建立使用者mysql

# useradd -M -s /sbin/nologin  mysql

5.安裝mysql服務

同時會生成初始的root密碼

[[email protected] bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --lc_messages_dir=/usr/local/mysql/share --lc_messages=en_US
2018-09-14T01:29:19.943304Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-09-14T01:29:22.889460Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-09-14T01:29:23.344284Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-09-14T01:29:23.467257Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9c5a6727-b7bd-11e8-950d-00163e000746.
2018-09-14T01:29:23.478545Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-09-14T01:29:23.481101Z 1 [Note] A temporary password is generated for 
[email protected]
: WtuINdwKl9/I [[email protected] bin]#

6.設定開機啟動

[[email protected] mysql]# ls
bin  COPYING  data  docs  include  lib  man  README  share  support-files
[[email protected] mysql]# cd support-files/
[[email protected] support-files]# ls
magic  mysqld_multi.server  mysql-log-rotate  mysql.server
[
[email protected]
support-files]# cp mysql.server /etc/init.d/mysql [[email protected] support-files]# chmod +x /etc/init.d/mysql [[email protected] support-files]# chkconfig --add mysql [[email protected] support-files]# chkconfig --list mysql mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

7.mysql 服務開啟

[[email protected] support-files]# service mysql start
Starting MySQL                                             [  OK  ]

8.進入mysql中

密碼為第四步中生成的初始化密碼

[[email protected] bin]# ./mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23

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> set password=password("修改密碼");
Query OK, 0 rows affected, 1 warning (0.00 sec)

9.給外網ip配置訪問許可權

mysql> grant all privileges on *.* to 'root'@'%' identified by '[email protected]@2018';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> 

其他

1.mysql -u root -p  -bash:mysql:command not found 時解決方式

[[email protected] bin]# mysql -u root -p
-bash: mysql: command not found
[[email protected] bin]# ln -s /usr/local/mysql/bin/mysql /usr/bin
[[email protected] bin]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
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> 

2.修改檢視mysql的最大連線數

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)

mysql> set globla max_connections=500;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'max_connections=500' at line 1
mysql> set global max_connections=500;  
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 500   |
+-----------------+-------+
1 row in set (0.00 sec)

3.檢視mysql的所有遠端連線情況

mysql> show processlist;
+----+------+--------------------+------+---------+------+----------+------------------+
| Id | User | Host               | db   | Command | Time | State    | Info             |
+----+------+--------------------+------+---------+------+----------+------------------+
|  6 | root | 112.17.87.192:2859 | NULL | Sleep   |  821 |          | NULL             |
|  7 | root | localhost          | NULL | Query   |    0 | starting | show processlist |
+----+------+--------------------+------+---------+------+----------+------------------+
2 rows in set (0.00 sec)

mysql> 

4.建立資料庫匯入sql指令碼

mysql> create database ds9;
Query OK, 1 row affected (0.00 sec)

mysql> use ds9;
Database changed
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> source /data/temp/ds9_v1.0_20180523.sql
Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.06 sec)

Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.06 sec)

Query OK, 0 rows affected (0.06 sec)

Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.06 sec)

Query OK, 0 rows affected (0.05 sec)

Query OK, 0 rows affected (0.05 sec)

相關推薦

linux 安裝tar.gz 方式安裝mysql5.7

檢查之前是否解除安裝乾淨mysql,參考之前的一篇部落格 1.下載安裝檔案 [[email protected] tmp]# wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/mysql-5.7.23-

linux zip tar gz bz2等各種檔案命令

大致總結了一下linux下各種格式的壓縮包的壓縮、解壓方法。但是部分方法我沒有用到,也就不全,希望大家幫我補充,我將隨時修改完善,謝謝!      .tar   解包:tar xvf FileName.tar   打包:tar cvf FileName.tar DirNam

Linux如何 tar.xz格式檔案

       摘要:由於有些檔案的壓縮格式為 tar.xz,就需要使用xz命令來對其進行解壓,接下來就讓我給大家講解一下如何使用xz命令來對tar.xz格式檔案進行解壓  1、由於mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz檔案是 

linuxtar xvzf是tar.gz的,等效gzip -d file.gz+tar vxf file.tar,以及別的方式大全

Linux下最常用的打包程式就是tar了,使用tar程式打出來的包我們常稱為tar包,tar包檔案的命令通常都是以.tar結尾的。生成tar包後,就可以用其它的程式來進 行壓縮了,所以首先就來講講tar命令的基本用法:   tar命令的選項有很多(用man tar可以檢視

Linuxtar.gztar.bz2報錯

Linux解壓tar.gz和tar.bz2的命令 兩者的命令主要是引數的不同,解壓tar.gz和tar.bz2不同壓縮檔案的命令如下: 解壓tar.gz檔案 tar -zxvf ×××.tar.gz 解壓tar.bz2檔案 tar -jxvf ×××

Linuxtar.gztar.bz2的命令

兩者的命令主要是引數的不同,解壓tar.gz和tar.bz2不同壓縮檔案的命令如下:    1 解壓tar.gz檔案 tar -zxvf ×××.tar.gz 1   2 解壓tar.bz2檔案 tar -jxvf ×××.tar.bz2 1   -z :是否同時具有

windows 呼叫gzip.exe 和tar.exe*.tar.gz壓縮包到指定目錄

如:解壓D:/test/1.tar.gz 到E:/test/下 1.切換到壓縮包所在目錄下 cd /d D: 2.呼叫gzip.exe解壓.gz壓縮檔案 gzip /test/1.tar.gz 3.呼叫tar.exe解包.tar tar xvf /test/1.tar -

Linuxtar.gz檔案時提示gzip:stdin:not錯誤

在解壓tar.gz檔案的時候報錯 [[email protected] Downloads]$ tar -zxvf clion-141.351.4.tar.gz gzip: stdin: not in gzip format tar: Child returned

ubutun*.tar.gz檔案到指定資料夾

先用cd命令進入存放待解壓的檔案的資料夾 然後再使用命令為 sudo tar -zxvf *.tar.gz -C 指定目錄名 解壓 如: sudo tar -zxvf jdk-8u121-linux-x64.tar.gz -C /usr/java

linux各種命令

好用 ast 網絡 所有 備份 pm2 文件壓縮 註意 詳細 .tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(註:tar是打包,不是壓縮!)———————————————.gz解壓1:gunzip Fi

編寫一個shall腳本,采用case語句,自動“.tar.gz”或“.tar.bz2”格式文件

名稱 ech .tar.gz 軟件包 all export 解壓 case語句 cas #!/bin/bash#thisexport LC_ALL=C read -p "請輸入軟件包名稱:" PAG case $PAG in *[z] )

Linux使用shelltar.Z格式檔案

建設當前目錄下有一個名為test.tar.Z的檔案。 使用如下指令可以將其解壓,並將解壓後的所有檔案放置在當前目錄下: zcat test.tar.Z | tar -xvf - 如果想要將解壓縮的檔案解壓的指定的目錄,使用-C引數即可: mkdir target; zcat test.tar.Z | t

tar命令.tar.gz檔案時的錯誤

某些linux版本的機器上使用 tar -zxvf *.tar.gz 命令解壓.tar.gz時會出現"tar: z: unknown function modifier"錯誤。 而使用 tar -x *.tar.gz 會出現“tar: /dev/rmt/0: No suc

Linux打包命令

tar 壓縮:    tar -cvjpf etc.tar.bz2 /etc  //-c為建立一個打包檔案,相應的-f後面接建立的檔案的名稱,使用了.tar.bz2字尾,-j標誌使用bzip2壓縮,最後面為具體的操作物件/etc目錄    檢視:    tar -tvjf etc.tar.bz2

*.tar.gz 檔案

linux下的很軟體都是 tar.gz字尾的,解壓久了不用就忙了,寫備忘。現我知的直接解壓方法有兩種 1.gunzip與tar gunzip <*.tar.gz | tar -xvf - 2.只用tartar -zxvf *.tar.gz 說明: z表示:通過gzi

linux各種方法

大致總結了一下linux下各種格式的壓縮包的壓縮、解壓方法。但是部分方法我沒有用到,也就不全,希望大家幫我補充,我將隨時修改完善,謝謝!    .tar    解包:tar xvf FileName.tar    打包:tar cvf FileName.tar D

shell批量tar.gz tgz

cd /root/home/ ls *.tar.gz > ls.log ls *.tgz >> ls.log for i in $( cat ls.log ) do tar -zxf $i & > /dev/null done rm -rf

Linux批量多個zip檔案的方法

一、首先安裝 $sudo urpmi unzip unrar 二、 進入到所在資料夾,然後有如下幾種方法可用 法一:用分號或者&&隔開(適用於物件較少的時候) unzip a.zip && unzip b.z

tar gzip biz2 的使用,tar.gz檔案,執行.sh指令碼

bzip2的簡單使用方法和gzip一樣:壓縮不用引數,解壓引數-d gzip的使用: gzip 壓縮的時候不用引數,直接使用就好了 gzip file -v 可以使用-v引數來檢視壓縮率 gzip -v file注意:用gzip壓縮的檔案,可以在windows下用winRar

關於linux壓縮

tar-c: 建立壓縮檔案-x:解壓-t:檢視內容-r:向壓縮歸檔檔案末尾追加檔案-u:更新原壓縮包中的檔案這五個是獨立的命令,壓縮解壓都要用到其中一個,可以和別的命令連用但只能用其中一個。下面的引數是根據需要在壓縮或解壓檔案時可選的。-z:有gzip屬性的-j:有bz2屬性