《MySQL數(shù)據(jù)庫(kù)多種安裝方法及企業(yè)級(jí)安裝實(shí)踐(下篇)》要點(diǎn):
本文介紹了MySQL數(shù)據(jù)庫(kù)多種安裝方法及企業(yè)級(jí)安裝實(shí)踐(下篇),希望對(duì)您有用。如果有疑問,可以聯(lián)系我們。
接《MySQL數(shù)據(jù)庫(kù)多種安裝方法及企業(yè)級(jí)安裝實(shí)踐(上篇)》
上述配置完畢后,就可以初始化數(shù)據(jù)庫(kù)文件了,這個(gè)步驟其實(shí)也可以在編譯安裝MySQL之后就操作,只不過(guò)放到這里更合理一些.
(1)初始化MySQL數(shù)據(jù)庫(kù)
初始化數(shù)據(jù)庫(kù)的核心命令為:
application/mysql/scripts/mysql_install_db –basedir=/application/mysql/ –datadir=/application/mysql/data –user=mysql
提示:–basedir=/application/mysql/為MySQL的安裝路徑,–datadir為數(shù)據(jù)文件目錄.另,注意mysql_install_db和MySQL5.1的路徑不同,MySQL5.1不在MySQL bin路徑下了.
整個(gè)初始化的操作過(guò)程為:
[root@oldboy mysql-5.6.34]# /application/mysql/scripts/mysql_install_db –basedir=/application/mysql/ –datadir=/application/mysql/data –user=mysql
#<==初始化mysql數(shù)據(jù)庫(kù)文件,會(huì)有很多信息提示,如果沒有ERROR級(jí)別的錯(cuò)誤,有兩個(gè)OK的字樣,表示初始化成功,否則就要解決初始化的問題.
Installing MySQL system tables…2017-02-26 18:08:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-26 18:08:53 0 [Note] Ignoring –secure-file-priv value as server is running with –bootstrap.
2017-02-26 18:08:53 0 [Note] /application/mysql//bin/mysqld (mysqld 5.6.34) starting as process 47993 …
2017-02-26 18:08:53 47993 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-02-26 18:08:53 47993 [Note] InnoDB: The InnoDB memory heap is disabled
2017-02-26 18:08:53 47993 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-02-26 18:08:53 47993 [Note] InnoDB: Memory barrier is not used
2017-02-26 18:08:53 47993 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-02-26 18:08:53 47993 [Note] InnoDB: Using Linux native AIO
2017-02-26 18:08:53 47993 [Note] InnoDB: Using CPU crc32 instructions
2017-02-26 18:08:53 47993 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-02-26 18:08:53 47993 [Note] InnoDB: Completed initialization of buffer pool
2017-02-26 18:08:53 47993 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-02-26 18:08:53 47993 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-02-26 18:08:53 47993 [Note] InnoDB: Database physically writes the file full: wait…
…省略若干…
2017-02-26 18:08:54 47993 [Note] InnoDB: Waiting for purge to start
2017-02-26 18:08:54 47993 [Note] InnoDB: 5.6.34 started; log sequence number 0
2017-02-26 18:08:54 47993 [Note] Binlog end
2017-02-26 18:08:54 47993 [Note] InnoDB: FTS optimize thread exiting.
2017-02-26 18:08:54 47993 [Note] InnoDB: Starting shutdown…
2017-02-26 18:08:55 47993 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK?
#<==兩個(gè)OK是初始化成功的標(biāo)志.
Filling help tables…2017-02-26 18:08:55 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-26 18:08:55 0 [Note] Ignoring –secure-file-priv value as server is running with –bootstrap.
2017-02-26 18:08:55 0 [Note] /application/mysql//bin/mysqld (mysqld 5.6.34) starting as process 48015 …
2017-02-26 18:08:55 48015 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-02-26 18:08:55 48015 [Note] InnoDB: The InnoDB memory heap is disabled
…省略若干…
2017-02-26 18:08:56 48015 [Note] InnoDB: FTS optimize thread exiting.
2017-02-26 18:08:56 48015 [Note] InnoDB: Starting shutdown…
2017-02-26 18:08:57 48015 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK?
#<==兩個(gè)OK是初始化成功的標(biāo)志.
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:
/application/mysql//bin/mysqladmin -u root password ‘new-password’
/application/mysql//bin/mysqladmin -u root -h oldboy password ‘new-password’
Alternatively you can run:
/application/mysql//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 . ; /application/mysql//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
###請(qǐng)注意如下幾行英文的說(shuō)明
New default config file was created as /application/mysql//my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
#從上文說(shuō)明中可以指導(dǎo)mysql的默認(rèn)配置文件已經(jīng)變到了/application/mysql//my.cnf
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
#從上文說(shuō)明中可以看到數(shù)據(jù)庫(kù)啟動(dòng)時(shí)會(huì)讀取/etc/my.cnf,因此有可能會(huì)導(dǎo)致無(wú)法啟動(dòng),避免的方法就是使用mysqld_safe 啟動(dòng)服務(wù)時(shí)采用–defaults-file參數(shù)指定配置文件,前文已將/etc/my.cnf改名了,所以,就不需要指定參數(shù)了,這里是一個(gè)坑,讀者要注意.
此步驟必須要初始化成功,否則,后面會(huì)出現(xiàn)登錄不了數(shù)據(jù)庫(kù)等各種問題.
(2)初始化數(shù)據(jù)庫(kù)的原理及結(jié)果說(shuō)明
初始化數(shù)據(jù)庫(kù)的實(shí)質(zhì)就是創(chuàng)建基礎(chǔ)的數(shù)據(jù)庫(kù)系統(tǒng)的庫(kù)文件,例如:生成MySQL庫(kù)表等.
初始化數(shù)據(jù)庫(kù)后,查看數(shù)據(jù)目錄,可以看到多了如下文件:
[root@oldboy mysql-5.6.34]# ls -l /application/mysql/data
total 110604
-rw-rw—-. 1 mysql mysql 12582912 Feb 26 18:08 ibdata1
-rw-rw—-. 1 mysql mysql 50331648 Feb 26 18:08 ib_logfile0
-rw-rw—-. 1 mysql mysql 50331648 Feb 26 18:08 ib_logfile1
drwx——. 2 mysql mysql?? ??4096 Feb 26 18:08 mysql???#<==用于存放管理mysql的數(shù)據(jù).
drwx——. 2 mysql mysql???? 4096 Feb 26 18:08 performance_schema??#<==5.5及以上增加的內(nèi)部性能庫(kù).
drwxr-xr-x. 2 mysql mysql???? 4096 Feb 26 17:48 test????#<==用于測(cè)試的test數(shù)據(jù)庫(kù).
[root@oldboy mysql-5.6.34]# tree /application/mysql/data?#<==如果沒有tree,可以yum install tree?–y安裝
/application/mysql/data
├── ibdata1
├── ib_logfile0
├── ib_logfile1
├── mysql
│???├── columns_priv.frm
│???├── columns_priv.MYD
│???├── columns_priv.MYI
…省略若干…
│???├── general_log.CSV
│???├── general_log.frm
│???├── help_category.frm
│???├── procs_priv.frm
│???├── procs_priv.MYD
│???├── procs_priv.MYI
│???├── proxies_priv.frm
│???├── proxies_priv.MYD
│???├── proxies_priv.MYI
│???├── servers.frm
…省略若干…
│???├── time_zone_name.MYI
│???├── time_zone_transition.frm
│???├── time_zone_transition.MYD
│???├── time_zone_transition.MYI
│???├── time_zone_transition_type.frm
│???├── time_zone_transition_type.MYD
│???├── time_zone_transition_type.MYI
│???├── user.frm
│???├── user.MYD
│???└── user.MYI
├── performance_schema
│???├── accounts.frm
│???├── cond_instances.frm
│???├── db.opt
│???├── events_stages_current.frm
│???├── events_stages_history.frm
│???├── events_stages_history_long.frm
│???├── events_stages_summary_by_account_by_event_name.frm
…省略若干…
│???├── threads.frm
│???└── users.frm
└── test
??? └── db.opt
3 directories, 136 files
(3)MySQL初始化故障排錯(cuò)集錦
本節(jié)的所有故障必須要解除,否則,后面會(huì)出現(xiàn)登錄不了MySQL數(shù)據(jù)庫(kù)等各種問題,故障集錦見本章結(jié)尾內(nèi)容.
1)設(shè)置MySQL啟動(dòng)腳本
[root@oldboy mysql-5.6.34]# pwd
/home/oldboy/tools/mysql-5.6.34
[root@oldboy mysql-5.6.34]# cp support-files/mysql.server /etc/init.d/mysqld?#<==拷貝mysql啟動(dòng)腳本到mysql的命令路徑.
[root@oldboy mysql-5.6.34]# chmod 700 /etc/init.d/mysqld??#<==使腳本可執(zhí)行.
[root@oldboy mysql-5.6.34]# ls -l /etc/init.d/mysqld
-rwx——. 1 root root 10929 Feb 26 18:26 /etc/init.d/mysqld
2)啟動(dòng)MySQL數(shù)據(jù)庫(kù)
#<==這是啟動(dòng)數(shù)據(jù)庫(kù)規(guī)范方法之一,還可以使用/application/mysql/bin/mysqld_safe –user=mysql &啟動(dòng).這個(gè)命令結(jié)尾?“&”符號(hào)作用是,在后臺(tái)執(zhí)行mysql服務(wù),這條命令執(zhí)行完 還需要按下回車才能進(jìn)入到命令行狀態(tài).
#<==注意,如果已執(zhí)行上面/etc/init.d/mysqld start啟動(dòng)命令,還想嘗試下面mysqld_safe的命令,請(qǐng)先執(zhí)行/etc/init.d/mysqld stop結(jié)束mysql進(jìn)程.
[root@oldboy mysql-5.6.34]# cd ~
[root@oldboy mysql-5.6.34]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
提示:禁止使用pkill、kill -9、killall -9等命令強(qiáng)制殺死數(shù)據(jù)庫(kù),這會(huì)引起數(shù)據(jù)庫(kù)無(wú)法啟動(dòng)等故障發(fā)生.企業(yè)中曾發(fā)生過(guò)的血的教訓(xùn)案例請(qǐng)看http://oldboy.blog.51cto.com/2561410/1431161.
3)檢查MySQL數(shù)據(jù)庫(kù)是否啟動(dòng).
[root@oldboy ~]# netstat -lntup|grep mysql?
tcp??????? 0????? 0 :::3306????????????? :::*????????????????? LISTEN????? 48065/mysqld
如發(fā)現(xiàn)3306端口沒起來(lái).請(qǐng)使用tail -100 /application/mysql/data/機(jī)器名.err檢查日志報(bào)錯(cuò)進(jìn)行調(diào)試.經(jīng)常查看服務(wù)運(yùn)行日志是個(gè)很好的習(xí)慣,也是高手的習(xí)慣,你要不要成為高手?
4)查看MySQL數(shù)據(jù)庫(kù)啟動(dòng)結(jié)果日志.
[root@oldboy ~]# tail /application/mysql/data/oldboy.err
2017-02-26 17:38:36 48065 [Note] InnoDB: Waiting for purge to start
2017-02-26 17:38:36 48065 [Note] InnoDB: 5.6.34 started; log sequence number 1625987
2017-02-26 17:38:36 48065 [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: 4f94404a-fc74-11e6-8112-000c292ece3f.
2017-02-26 17:38:36 48065 [Note] Server hostname (bind-address): ‘*’; port: 3306
2017-02-26 17:38:36 48065 [Note] IPv6 is available.
2017-02-26 17:38:36 48065 [Note]?? – ‘::’ resolves to ‘::’;
2017-02-26 17:38:36 48065 [Note] Server socket created on IP: ‘::’.
2017-02-26 17:38:36 48065 [Note] Event Scheduler: Loaded 0 events
2017-02-26 17:38:36 48065 [Note] /application/mysql-5.6.34/bin/mysqld: ready for connections.
Version: ‘5.6.34’? socket: ‘/application/mysql-5.6.34/tmp/mysql.sock’? port: 3306? Source distribution
本例查看了錯(cuò)誤日志的命令及錯(cuò)誤日志中的內(nèi)容,這里省略了大部分日志內(nèi)容,只給了默認(rèn)10行,如果有錯(cuò)誤,一般會(huì)顯示error字樣.
5)設(shè)置MySQL開機(jī)自啟動(dòng).
[root@oldboy ~]# chkconfig –add mysqld
[root@oldboy ~]# chkconfig –list mysqld
mysqld???????? ?0:off??? ?1:off??? 2:on 3:on 4:on 5:on 6:off此外,將啟動(dòng)命令/etc/init.d/mysqld start放到/etc/rc.local里面實(shí)現(xiàn)開機(jī)自啟動(dòng)也可.
若MySQL安裝及使用出現(xiàn)故障,可根據(jù)下面的分析思路進(jìn)行檢查.
細(xì)看所有執(zhí)行命令返回的屏幕輸出,不要忽略關(guān)鍵的輸出內(nèi)容.
輔助查看系統(tǒng)日志/var/log/messages.
如果是MySQL關(guān)聯(lián)了其他服務(wù),要同時(shí)查看相關(guān)服務(wù)的日志.
仔細(xì)閱讀,重新查看操作的步驟是否正確,書寫的命令及字符是不是都對(duì).
經(jīng)常查看各種服務(wù)運(yùn)行日志是個(gè)很好的習(xí)慣,也是成長(zhǎng)為高手的必經(jīng)之路,你要不要成為高手?
如果不為MySQL的命令配置全局路徑,就無(wú)法直接在命令行輸入mysql這樣的命令,只能用全路徑命令(/application/mysql/bin/mysql),這種帶著路徑輸入命令的方式很麻煩.下面來(lái)看看配置的具體方法.
1)確認(rèn)mysql命令所在的路徑.
root@oldboy /]# ls /application/mysql/bin/mysql
/application/mysql/bin/mysql
2)在PATH變量前面增加/application/mysql/bin路徑,并追加到/etc/profile文件中.
[root@oldboy /]# echo ‘export PATH=/application/mysql/bin:$PATH’ >>/etc/profile
#<==注意,echo后是單引號(hào)呦,雙引號(hào)是不行滴.
[root@oldboy /]# tail -1 /etc/profile
export PATH=/application/mysql/bin:$PATH
[root@oldboy /]# source /etc/profile
#<==執(zhí)行source使上一行添加到/etc/profile中,內(nèi)容直接生效
#<==以上命令的用途為,定義mysql全局路徑,實(shí)現(xiàn)在任意路徑執(zhí)行mysql命令.
[root@oldboy ~]# echo $PATH
/application/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
#<==執(zhí)行echo $PATH有/application/mysql/bin輸出表示配置成功.
提示:更簡(jiǎn)單的設(shè)置方法為用下面命令做軟鏈接:ln -s /application/mysql/bin/* /usr/local/sbin/,把mysql命令所在路徑鏈接到全局路徑/usr/local/sbin/的下面.
要特別強(qiáng)調(diào)的是,務(wù)必把MySQL命令路徑放在PATH路徑中其他路徑的前面,否則,可能會(huì)導(dǎo)致使用的mysql等命令和編譯安裝的mysql命令不是同一個(gè),進(jìn)而產(chǎn)生錯(cuò)誤.下面的網(wǎng)址中給出了因?yàn)镸ySQL路徑配置問題導(dǎo)致的錯(cuò)誤案例:http://oldboy.blog.51cto.com/2561410/1122867,該錯(cuò)誤實(shí)際上就是因?yàn)槭褂脃um安裝的MySQL客戶端命令訪問了編譯安裝的服務(wù)端而導(dǎo)致的.
登錄并測(cè)試的命令如下:
[root@oldboy ~]# mysql?#<==直接敲mysql就進(jìn)入數(shù)據(jù)庫(kù)了,而且身份還是root.
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34 Source distribution
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>
提示:你還可以使用如下三種命令寫法登錄mysql:
mysql -uroot -p,
mysql -uroot,
mysql -uroot -p ‘密碼’
若出現(xiàn)登錄故障,可通過(guò)以下方法排查.
如果這里提示無(wú)法登錄,排除了數(shù)據(jù)庫(kù)啟動(dòng)問題后,則很可能是數(shù)據(jù)庫(kù)初始化文件有問題.例如:
[root@oldboy ~]#?mysql
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
解決辦法:重新初始化數(shù)據(jù)庫(kù)即可,此問題一般都是數(shù)據(jù)庫(kù)初始化問題,或者數(shù)據(jù)庫(kù)文件損壞,以及目錄權(quán)限問題.
mysql> show databases; ?#<==查看當(dāng)前的數(shù)據(jù)庫(kù)
+——————–+
| Database?????????? |
+——————–+
| information_schema |
| mysql????????????? |
| performance_schema |
| test?????????????? |
+——————–+
4 rows in set (0.00 sec)
mysql> select user(); ?#<==查看當(dāng)前的登錄用戶
+—————-+
| user()???????? |
+—————-+
| root@localhost |
+—————-+
1 row in set (0.00 sec)
mysql>? ?#<==快捷鍵ctrl+d,也可以使用quit或exit等.
MySQL安裝完成后,默認(rèn)情況下,管理員賬號(hào)root是無(wú)密碼的,極不安全,必須要處理一下.
1.?為root用戶設(shè)置密碼
MySQL管理員的賬號(hào)root密碼默認(rèn)為空,極不安全,可以通過(guò)mysqladmin命令為mysql不同實(shí)例的數(shù)據(jù)庫(kù)設(shè)置獨(dú)立的密碼.
[root@oldboy ~]# mysqladmin -u root password ‘oldboy123’?#<==為root用戶設(shè)置密碼oldboy123.
Warning: Using a password on the command line interface can be insecure.?#<==這里是一個(gè)警告,提醒用戶命令行放置密碼是不安全的,讀者盡量不要在命令行輸入密碼,而是采取交互式的輸入密碼.
[root@oldboy ~]# mysql?#<==無(wú)法直接輸入命令登錄了.
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
[root@oldboy ~]# mysql -uroot -p?#<==新的登錄方式,也可以直接帶密碼mysql -uroot -poldboy123.
Enter password: ???????#<==輸入新密碼oldboy123,交互式輸入密碼不會(huì)記錄在命令記錄里,因此更安全.
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.34 Source distribution
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>
讀者也可以執(zhí)行mysql_secure_installation命令交互式地設(shè)置系統(tǒng)的用戶密碼.
2.?清理mysql服務(wù)器內(nèi)無(wú)用的用戶
select user,host from mysql.user;
+——+———–+
| user | host????? |
+——+———–+
| root | 127.0.0.1 |
| root | ::1?????? |
|????? | localhost |
| root | localhost |
|????? | oldboy??? |
| root | oldboy??? |
+——+———–+
6 rows in set (0.00 sec)
mysql> drop user root@’::1′;
Query OK, 0 rows affected (0.00 sec)
mysql> drop user root@’oldboy’;
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ”@’oldboy’;
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ”@’localhost’;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user;
+——+———–+
| user | host????? |
+——+———–+
| root | 127.0.0.1 |
| root | localhost |
+——+———–+
2 rows in set (0.00 sec)
提示:對(duì)于drop命令及數(shù)據(jù)庫(kù)安全,后文會(huì)有詳細(xì)講解,?此處不執(zhí)行也可以.
有時(shí)用drop命令可能無(wú)法刪除對(duì)應(yīng)用戶.比如,當(dāng)數(shù)據(jù)庫(kù)內(nèi)的host等字段為大寫及特殊Linux主機(jī)名時(shí),刪除用戶就會(huì)遇到問題,例如:
mysql> drop user ‘ ‘@’MySQL’;??
ERROR 1396 (HY000): Operation DROP USER failed for ‘ ‘@’mysql’
可使用DML語(yǔ)句,并采用delete命令刪除來(lái)解決此問題,具體命令如下:
mysql> delete from mysql.user where user=” and host=’MySQL’;
Query OK, 1 row affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
3.?刪除mysql數(shù)據(jù)庫(kù)內(nèi)無(wú)用的test庫(kù)
mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+——————–+
| Database?????????? |
+——————–+
| information_schema |
| mysql????????????? |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)
有關(guān)更多的MySQL的安全措施,在后文會(huì)有更詳細(xì)的講解.
出現(xiàn)的錯(cuò)誤如下:
checking?for?tgetent?in?-ltinfo…?no
checking?for?termcap?functions?library…?configure:?error:?No?curses/termcap?library?found
原因:缺少ncurses安裝包.
解決方法:使用yum -y install ncurses-devel命令.
警告是可以忽略的,如果非要解決則需修改對(duì)主機(jī)名的解析,使其和uname -n命令的結(jié)果一樣,如下:
[root@oldboy ~]# grep “`uname -n`” /etc/
hosts127.0.0.1? oldboy
故障2:錯(cuò)誤提示ERROR: 1004? Can’t create file ‘/tmp/#sql300e_1_0.frm’ (errno: 13)
在執(zhí)行初始化數(shù)據(jù)庫(kù)命令時(shí)可能就會(huì)遇到這樣的錯(cuò)誤,錯(cuò)誤提示如下:
ERROR: 1004? Can’t create file ‘/tmp/#sql300e_1_0.frm’ (errno: 13)
120406 15:47:02 [ERROR] Aborting
120406 15:47:02 [Note] /application/mysql/libexec/mysqld: Shutdown complete
Installation of system tables failed!?Examine the logs in
/application/mysql/data for more information.
根據(jù)提示可知,/tmp目錄不能創(chuàng)建文件,所以解決辦法為給/tmp目錄增加權(quán)限,如下:
解決辦法:還原/tmp目錄權(quán)限,操作命令如下:
[root@oldboy ~]# chmod 1777 /tmp?? #<==1777是/tmp的默認(rèn)權(quán)限,除非曾經(jīng)改動(dòng)過(guò)此目錄權(quán)限才會(huì)報(bào)錯(cuò).
[root@oldboy ~]# ls -ld /tmp/?????
drwsrwxrwt. 8 root root 4096 3月? 10 18:07 /tmp/
本示例的故障必須要解除,否則,后面會(huì)出現(xiàn)登錄不了MySQL數(shù)據(jù)庫(kù)等各種問題.
解答:正文里已給出答案,不再累述.
解答:正文里已給出答案,不再累述.
編譯參數(shù) | 說(shuō)明 |
-DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.34 | 設(shè)定mysql安裝目錄 |
-DMYSQL_DATADIR=/application/mysql-5.6.34/data | 設(shè)定mysql數(shù)據(jù)文件目錄 |
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.34/tmp/mysql.sock | 設(shè)定mysql.sock路徑 |
-DDEFAULT_CHARSET=utf8 | 設(shè)定默認(rèn)的字符集為utf8 |
-DDEFAULT_COLLATION=utf8_general_ci | 設(shè)定默認(rèn)排序規(guī)則 |
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii | 啟用額外的字符集類型 |
-DENABLED_LOCAL_INFILE=ON | 啟用本地?cái)?shù)據(jù)導(dǎo)入支持 |
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 |
若想啟用某個(gè)引擎的支持,-DWITH_<ENGINE>_STORAGE_ENGINE=1
若想禁用某個(gè)引擎的支持:-DWITHOUT_<ENGINE>_STORAGE_ENGINE=0 |
-DWITH_FAST_MUTEXES=1 | |
-DWITH_ZLIB=bundled | 啟用libz庫(kù)支持 |
-DENABLED_LOCAL_INFILE=1 | 這個(gè)參數(shù)重復(fù)了,啟用本地?cái)?shù)據(jù)導(dǎo)入支持 |
-DWITH_READLINE=1 | 啟用readline庫(kù)支持(提供可編輯的命令行) |
-DWITH_EMBEDDED_SERVER=1 | 編譯嵌入式服務(wù)器支持 |
-DWITH_DEBUG=0 | 禁用debug(默認(rèn)為禁用)
|
更多內(nèi)容可以參考官方MySQL 5.6的cmake編譯參數(shù)http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
文章來(lái)自微信公眾號(hào):老男孩教育
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.snjht.com/jiaocheng/4237.html