發表文章

目前顯示的是 9月, 2016的文章

MySQL systemd on Linux 7

過去在Linux 6系列上用tar包安裝MySQL,要設定成系統服務很簡單,只要把mysql.server放在/etc/init.d裡面即可: cp support-files/mysql.server /etc/init.d/mysqld 但在Linux 7系列中service的角色已被systemd給取代(雖然service還是能用),但要設開機自動啟動chkconfig就會有問題: [root@mysql-course support-files]# chkconfig --list mysqld Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. 所以可以的話,我還是盡量設法弄成Linux 7相容的方式比較好 看了手冊的教學:https://dev.mysql.com/doc/refman/5.7/en/server-management-using-systemd.html 實在是太高深莫測了,我功力還不到家,看不太懂阿 後來看這篇http://superuser.com/questions/384365/systemctl-enable-differs-from-systemctl-start-how的說明,試做一下: [root@mysql-course ~]# systemctl status mysqld.service mysqld.service Loaded: not-found (Reason: No such file or di

MySQL壓測軟體tpcc-mysql

安裝 直接在GitHub下載 wget https://github.com/Percona-Lab/tpcc-mysql/archive/faa06df608d8bd36d540b0fc0042fd33debbde0c.zip 或是用bazaar來下載 wget http://mirror.centos.org/centos/7/os/x86_64/Packages/bzr-2.5.1-14.el7.x86_64.rpm rpm install bzr-2.5.1-14.el7.x86_64.rpm # cd src/ # make 因為我是用tar檔安裝MySQL的,所以它在編譯過程一直會找不到相關的library  [root@mysql-course src]# make cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load /usr/bin/ld: cannot find -lperconaserverclient collect2: error: ld returned 1 exit status make: *** [../tpcc_load] Error 1 爬了文說直接設定: export LD_LIBRARY_PATH=/opt/percona57/lib export C_INCLUDE_PATH=/opt/percona57/include/ export MYSQL_HOME=/opt/percona57 export PATH=$MYSQL_HOME/bin:$PATH 就可以解決,但我試了就是沒辦法,於是查了一下mysql_config裡的設定 [root@mysql-course src]# mysql_config --libs           [-L/opt/percona57/lib/mysql -lperconaserverclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl]         --libs_r         [-L/opt/percona57/lib/mysql -lperconaserverclient -lpthread