標籤:password ack ber initial int png amp bsp ice
11.1 LAMP架構介紹
11.2 MySQL、MariaDB介紹
11.3/11.4/11.5 MySQL安裝
擴充
mysql5.5源碼編譯安裝 http://www.aminglinux.com/bbs/thread-1059-1-1.html
mysql5.7二進位包安裝(變化較大) http://www.apelearn.com/bbs/thread-10105-1-1.html ====================================================================================================
==================================================================================================================================================================================================================
Last login: Mon Feb 26 20:46:31 2018
[[email protected] ~]# cd /usr/local/src
[[email protected] src]# ls
httpd-2.2.34 httpd-2.2.34.tar.gz
[[email protected] src]# uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
--2018-02-26 22:01:36-- http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
正在解析主機 mirrors.sohu.com (mirrors.sohu.com)... 221.236.12.140
正在串連 mirrors.sohu.com (mirrors.sohu.com)|221.236.12.140|:80... 已串連。
已發出 HTTP 要求,正在等待回應... 200 OK
長度:316320366 (302M) [application/octet-stream]
正在儲存至: “mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz”
100%[=================================>] 316,320,366 2.40MB/s 用時 2m 6s
2018-02-26 22:03:43 (2.39 MB/s) - 已儲存 “mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz” [316320366/316320366])
[[email protected] src]# ls
httpd-2.2.34 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
httpd-2.2.34.tar.gz
[[email protected] src]# tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
mysql-5.6.36-linux-glibc2.5-x86_64/mysql-test/README
mysql-5.6.36-linux-glibc2.5-x86_64/mysql-test/purify.supp
mysql-5.6.36-linux-glibc2.5-x86_64/mysql-test/collections/README
mysql-5.6.36-linux-glibc2.5-x86_64/mysql-test/collections/default.weekly-valgrind
mysql-5.6.36-linux-glibc2.5-x86_64/mysql-test/collections/disabled-gtid-on.list
====================================解壓部分刪除(太多了~)==================================================================================================================================================================================================================
[[email protected] src]# http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
-bash: http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz: 沒有那個檔案或目錄
[[email protected] src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql
[[email protected] src]# cd /usr/local/mysql/
[[email protected] mysql]# ls
bin data include man README share support-files
COPYING docs lib mysql-test scripts sql-bench
[[email protected] mysql]# ./scripts/mysql_install_db ^C
[[email protected] mysql]# useradd mysql
[[email protected] mysql]# mkdir /data
[[email protected] mysql]# ls /data/
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper
[[email protected] mysql]# yum install -y perl-XML-Dumper
已載入外掛程式:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00
epel/x86_64/metalink | 6.3 kB 00:00
epel | 4.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/3): epel/x86_64/updateinfo | 892 kB 00:00
(2/3): epel/x86_64/primary_db | 6.2 MB 00:00
(3/3): updates/7/x86_64/primary_db | 6.0 MB 00:01
Determining fastest mirrors
* epel: mirrors.ustc.edu.cn
正在解決依賴關係
--> 正在檢查事務
---> 軟體包 perl-XML-Dumper.noarch.0.0.81-17.el7 將被 安裝
--> 正在處理依賴關係 perl(XML::Parser),它被軟體包 perl-XML-Dumper-0.81-17.el7.noarch 需要
--> 正在檢查事務
---> 軟體包 perl-XML-Parser.x86_64.0.2.41-10.el7 將被 安裝
--> 解決依賴關係完成
依賴關係解決
===========================================================================
Package 架構 版本 源 大小
===========================================================================
正在安裝:
perl-XML-Dumper noarch 0.81-17.el7 base 25 k
為依賴而安裝:
perl-XML-Parser x86_64 2.41-10.el7 base 223 k
事務概要
===========================================================================
安裝 1 軟體包 (+1 依賴軟體包)
總下載量:247 k
安裝大小:669 k
Downloading packages:
(1/2): perl-XML-Dumper-0.81-17.el7.noarch.rpm | 25 kB 00:00
(2/2): perl-XML-Parser-2.41-10.el7.x86_64.rpm | 223 kB 00:00
---------------------------------------------------------------------------
總計 840 kB/s | 247 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : perl-XML-Parser-2.41-10.el7.x86_64 1/2
正在安裝 : perl-XML-Dumper-0.81-17.el7.noarch 2/2
驗證中 : perl-XML-Dumper-0.81-17.el7.noarch 1/2
驗證中 : perl-XML-Parser-2.41-10.el7.x86_64 2/2
已安裝:
perl-XML-Dumper.noarch 0:0.81-17.el7
作為依賴被安裝:
perl-XML-Parser.x86_64 0:2.41-10.el7
完畢!
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper
[[email protected] mysql]# yum install -y perl-Data-Dumper
已載入外掛程式:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
正在解決依賴關係
--> 正在檢查事務
---> 軟體包 perl-Data-Dumper.x86_64.0.2.145-3.el7 將被 安裝
--> 解決依賴關係完成
依賴關係解決
===========================================================================
Package 架構 版本 源 大小
===========================================================================
正在安裝:
perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
事務概要
===========================================================================
安裝 1 軟體包
總下載量:47 k
安裝大小:97 k
Downloading packages:
perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : perl-Data-Dumper-2.145-3.el7.x86_64 1/1
驗證中 : perl-Data-Dumper-2.145-3.el7.x86_64 1/1
已安裝:
perl-Data-Dumper.x86_64 0:2.145-3.el7
完畢!
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
Installing MySQL system tables...2018-02-26 22:17:38 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-26 22:17:38 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-02-26 22:17:38 0 [Note] ./bin/mysqld (mysqld 5.6.36) starting as process 3050 ...
2018-02-26 22:17:38 3050 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-02-26 22:17:38 3050 [Note] InnoDB: The InnoDB memory heap is disabled
2018-02-26 22:17:38 3050 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-02-26 22:17:38 3050 [Note] InnoDB: Memory barrier is not used
2018-02-26 22:17:38 3050 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-02-26 22:17:38 3050 [Note] InnoDB: Using Linux native AIO
2018-02-26 22:17:38 3050 [Note] InnoDB: Using CPU crc32 instructions
2018-02-26 22:17:38 3050 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-02-26 22:17:38 3050 [Note] InnoDB: Completed initialization of buffer pool
2018-02-26 22:17:38 3050 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2018-02-26 22:17:38 3050 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-02-26 22:17:38 3050 [Note] InnoDB: Database physically writes the file full: wait...
2018-02-26 22:17:38 3050 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-02-26 22:17:38 3050 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-02-26 22:17:39 3050 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-02-26 22:17:39 3050 [Warning] InnoDB: New log files created, LSN=45781
2018-02-26 22:17:39 3050 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-02-26 22:17:39 3050 [Note] InnoDB: Doublewrite buffer created
2018-02-26 22:17:39 3050 [Note] InnoDB: 128 rollback segment(s) are active.
2018-02-26 22:17:39 3050 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-02-26 22:17:39 3050 [Note] InnoDB: Foreign key constraint system tables created
2018-02-26 22:17:39 3050 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-02-26 22:17:39 3050 [Note] InnoDB: Tablespace and datafile system tables created.
2018-02-26 22:17:39 3050 [Note] InnoDB: Waiting for purge to start
2018-02-26 22:17:39 3050 [Note] InnoDB: 5.6.36 started; log sequence number 0
2018-02-26 22:17:39 3050 [Note] Binlog end
2018-02-26 22:17:39 3050 [Note] InnoDB: FTS optimize thread exiting.
2018-02-26 22:17:39 3050 [Note] InnoDB: Starting shutdown...
2018-02-26 22:17:41 3050 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2018-02-26 22:17:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-26 22:17:41 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-02-26 22:17:41 0 [Note] ./bin/mysqld (mysqld 5.6.36) starting as process 3072 ...
2018-02-26 22:17:41 3072 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-02-26 22:17:41 3072 [Note] InnoDB: The InnoDB memory heap is disabled
2018-02-26 22:17:41 3072 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-02-26 22:17:41 3072 [Note] InnoDB: Memory barrier is not used
2018-02-26 22:17:41 3072 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-02-26 22:17:41 3072 [Note] InnoDB: Using Linux native AIO
2018-02-26 22:17:41 3072 [Note] InnoDB: Using CPU crc32 instructions
2018-02-26 22:17:41 3072 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-02-26 22:17:41 3072 [Note] InnoDB: Completed initialization of buffer pool
2018-02-26 22:17:41 3072 [Note] InnoDB: Highest supported file format is Barracuda.
2018-02-26 22:17:41 3072 [Note] InnoDB: 128 rollback segment(s) are active.
2018-02-26 22:17:41 3072 [Note] InnoDB: Waiting for purge to start
2018-02-26 22:17:41 3072 [Note] InnoDB: 5.6.36 started; log sequence number 1625977
2018-02-26 22:17:41 3072 [Note] Binlog end
2018-02-26 22:17:41 3072 [Note] InnoDB: FTS optimize thread exiting.
2018-02-26 22:17:41 3072 [Note] InnoDB: Starting shutdown...
2018-02-26 22:17:43 3072 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password ‘new-password‘
./bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
[[email protected] mysql]# echo $?
0
[[email protected] mysql]# cp support-files/my-default.cnf /etc/my.cnf^C
[[email protected] mysql]# vim /etc/my.cnf
[[email protected] mysql]# ls
bin data include man mysql-test scripts sql-bench
COPYING docs lib my.cnf README share support-files
[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql]# vi /etc/init.d/mysqld
[[email protected] mysql]# ls -l /etc/init.d/mysqld
-rwxr-xr-x 1 root root 10592 2月 26 22:30 /etc/init.d/mysqld
[[email protected] mysql]# chkconfig --add mysqld
[[email protected] mysql]# chkconfig --list
注意:該輸出結果只顯示 SysV 服務,並不包含原生 systemd 服務。SysV 配置資料可能被原生 systemd 配置覆蓋。
如果您想列出 systemd 服務,請執行 ‘systemctl list-unit-files‘。
欲查看對特定 target 啟用的服務請執行
‘systemctl list-dependencies [target]‘。
mysqld 0:關1:關2:開3:開4:開5:開6:關
netconsole 0:關1:關2:關3:關4:關5:關6:關
network 0:關1:關2:開3:開4:開5:開6:關
[[email protected] mysql]# service mysqld start
Starting MySQL.Logging to ‘/data/mysql/localhost.localdomain.err‘.
.. SUCCESS!
[[email protected] mysql]# ps aux |grep mysql
root 3358 0.0 0.0 11776 1584 pts/0 S 22:33 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid
mysql 3495 5.6 10.8 1300792 453080 pts/0 Sl 22:33 0:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock
root 3523 0.0 0.0 112676 976 pts/0 S+ 22:34 0:00 grep --color=auto mysql
[[email protected] mysql]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1091/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1638/master
tcp6 0 0 :::3306 :::* LISTEN 3495/mysqld
tcp6 0 0 :::22 :::* LISTEN 1091/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1638/master
[[email protected] mysql]# killall 3358
-bash: killall: 未找到命令
[[email protected] mysql]# killall mysql
-bash: killall: 未找到命令
[[email protected] mysql]# /etc/init.d/mysqld stop
Shutting down MySQL.. SUCCESS!
[[email protected] mysql]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1091/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1638/master
tcp6 0 0 :::22 :::* LISTEN 1091/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1638/master
[[email protected] mysql]#
九周第四次課(2月26日) 11.1 LAMP架構介紹 11.2 MySQL、MariaDB介紹 11.3/11.4/11.5 MySQL安裝 擴充 mysql5.5源碼編譯安裝