Blast2GO 是一個基于序列相似性搜索的 GO 注釋和功能分析工具,它可以直接統(tǒng)計分析基因功能信息,并可視化 GO 有向非循環(huán)圖(DAG)上的相關功能特征,分析 BLAST、GO-mapping、GO 注釋分析和富集分析結果。
Blast2GO Command Line (CLI) 的使用需要滿足 Java 與 MySQL 的預安裝。
Blast2GO Command Line (CLI) is a Java application and can be run on Mac, Linux and Windows 64-bit systems. It is always necessary to have Java 64-bit (version 1.6 or higher preferably from Sun/Oracle) installed, at least 1GB of RAM is recommended. The Blast2GO Command Line needs a Blast2GO database (DB) to perform the mapping step. This DB can be generated with the CLI itself; however the previous installation and configuration of a MySQL server (GPL license) is necessary.
From:Blast2GO Command Line User Manual
作為 Blast2GO 本地化所依賴的數(shù)據(jù)庫,下面我們介紹一下 MySQL 的安裝配置、存儲位置修改及新版中低級密碼設置不允許的解決方法。
MySQL 的官網(wǎng)下載地址 https://www.mysql.com/downloads/ 的界面會有幾個版本的選擇,這幾個版本的區(qū)別如下。
Oracle MySQL Cloud Service (commercial)基于 MySQL 企業(yè)版構建的 Oracle MySQL 云服務,由 Oracle Cloud 提供技術支持,提供企業(yè)級的 MySQL 數(shù)據(jù)庫服務,需付費。
MySQL Enterprise Edition (commercial) MySQL 企業(yè)版本,包含了最全面的 MySQL 高級特性和管理工具。需付費,可以試用 30 天。
MySQL Cluster CGE (commercial)。MySQL 高級集群版,是一個實時開源事務數(shù)據(jù)庫,專為在高吞吐量條件下快速,永久地訪問數(shù)據(jù)而設計。需付費。
MySQL Community Edition (GPL)MySQL 社區(qū)版本,開源免費,但不提供官方技術支持。
MySQL Community Edition(社區(qū)免費版,https://dev.mysql.com/downloads/) 又分為 MySQL Community Server、MySQL Cluster、MySQL Router、MySQL Shell、MySQL Workbench、MySQL on Windows、…、MySQL SUSE Repository 等根據(jù)不同的操作系統(tǒng)平臺細分為多個版本。其中 MySQL Community Server 是開源免費的,這也是我們通常用的 MySQL 的版本。
MySQL 提供了 rpm、源碼、免安裝等多種安裝方式,其中通過源碼編譯安裝是比較耗時,過程相對復雜的一個過程。對于不想使用源碼編譯安裝的童鞋,MySQL 提供了免安裝直接解壓可用的版本。
$ wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.12-el7-x86_64.tar.gz
我們以 CentOS/RedHat 平臺為例來說明。進入 MySQL Community Server 下載頁面https://dev.mysql.com/downloads/mysql/,在適合 Linux 系統(tǒng)的 Source Code 源碼中選擇帶有 Boost 頭的壓縮包(MySQL 需要 Boost C++ 庫構建)進行下載。
Source Code:源代碼下載
Generic Linux (Architecture Independent):通用的 Linux(獨立結構)。
點擊下載,需要注冊 Oracle 賬號,這里不細說。
eg. https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.12.tar.gz
其他下載版本
如果想要下載其他版本的 MySQL,可以在 https://downloads.mysql.com/archives/community/ 選擇符合自己服務器的版本進行下載。
[root@ecs-steven ~]# yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison doxygen
[root@ecs-steven ~]# groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
[root@ecs-steven ~]# mkdir /usr/local/software/mysql# mysql-8.0.12 中可以不用新建數(shù)據(jù)保存的路徑,在初始化 MySQL 數(shù)據(jù)庫時可通過 --datadir 參數(shù)自動生成[root@ecs-steven ~]# mkdir /usr/local/software/mysql/{log,data} -p
Tip:真實的生產(chǎn)環(huán)境一般來說會把數(shù)據(jù)獨立放在根目錄下,方便磁盤掛載上去。
[root@ecs-steven mysql-8.0.12]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/software/mysql \-DMYSQL_DATADIR=/usr/local/software/mysql/data \-DWITH_BOOST=./boost \-DSYSCONFDIR=/etc \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_FEDERATED_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_ARCHIVE_STORAGE_ENGINE=1 \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DENABLED_LOCAL_INFILE=1 \-DDEFAULT_CHARSET=utf8mb4 \-DDEFAULT_COLLATION=utf8mb4_general_ci \-DWITH_EMBEDDED_SERVER=1 \-DEXTRA_CHARSETS=all \-DMYSQL_TCP_PORT=3306 \-DWITH_SSL=system \-DMYSQL_UNIX_ADDR=/usr/local/software/mysql/mysqld.sock
各個參數(shù)解釋:(詳細說明,參考 MySQL 8.0 Reference Manual - 2.8.4 MySQL Source-Configuration Options)
-DCMAKE_INSTALL_PREFIX=/usr/local/software/mysql //安裝路徑-DMYSQL_DATADIR=/usr/local/software/mysql/data //數(shù)據(jù)文件存放位置-DWITH_BOOST=./boost //指定 boost 的位置-DSYSCONFDIR=/etc //設置 my.cnf 配置文件的所在目錄,默認為安裝目錄 -DWITH_INNOBASE_STORAGE_ENGINE=1 //安裝 InnoDB 引擎-DWITH_BLACKHOLE_STORAGE_ENGINE=1 //安裝 blackhole 存儲引擎-DWITH_ARCHIVE_STORAGE_ENGINE=1 //安裝 archive 存儲引擎-DWITH_MYISAM_STORAGE_ENGINE=1 //安裝 myisam 存儲引擎-DWITH_PARTITION_STORAGE_ENGINE=1 //安裝支持數(shù)據(jù)庫分區(qū) -DENABLED_LOCAL_INFILE=1 //允許從本地導入數(shù)據(jù)-DDEFAULT_CHARSET=utf8mb4 //存儲 emoji 時使用 utf8 數(shù)據(jù)會出錯,建議使用完全兼容 utf8 的 utf8mb4-DDEFAULT_COLLATION=utf8mb4_general_ci //設置默認校對規(guī)則-DWITH_EMBEDDED_SERVER=1 //嵌入式服務器,MySQL 8.0 起該參數(shù)已經(jīng)被移除-DEXTRA_CHARSETS=all //安裝所有擴展字符集-DMYSQL_TCP_PORT=3306 //指定 TCP 端口為 3306 -DWITH_SSL=system //啟用系統(tǒng) OpenSSL 庫支持(yes 等同于 system )-DMYSQL_UNIX_ADDR=/usr/local/software/mysql/mysqld.sock //指定 mysql.sock 路徑
[root@ecs-steven mysql-8.0.12]# make -j `grep processor /proc/cpuinfo | wc -l`#編譯很消耗系統(tǒng)資源,小內存可能編譯通不過[root@ecs-steven mysql-8.0.12]# make install
MySQL 服務器有許多操作參數(shù),我們可以使用命令行選項或配置文件(option files)在服務器啟動時更改這些參數(shù)。
在 Windows 上,MySQL 安裝程序會在基本安裝目錄中創(chuàng)建名為 my.ini 的文件作為默認選項文件(沒有的話,可以自行創(chuàng)建)。在 Linux 中,MySQL 服務會依次從 /etc/my.cnf、/etc/mysql/my.cnf、/usr/local/mysql/etc/my.cnf、~/.my.cnf 讀取默認的 my.cnf 配置文件;在命令行下可使用 mysqld –verbose –help 命令查看 MySQL 讀取配置文件后啟動的參數(shù)。
[root@ecs-steven etc]# cat /etc/my.cnf[client]port = 3306socket = /usr/local/software/mysql/mysqld.sock[mysqld]port = 3306socket = /usr/local/software/mysql/mysqld.sockbasedir = /usr/local/software/mysqldatadir = /usr/local/software/mysql/datapid-file = /usr/local/software/mysql/data/mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 1init-connect = 'SET NAMES utf8mb4'character-set-server = utf8mb4back_log = 300max_connections = 1000max_connect_errors = 6000open_files_limit = 65535table_open_cache = 128max_allowed_packet = 4Mbinlog_cache_size = 1Mmax_heap_table_size = 8Mtmp_table_size = 16Mread_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 4Mthread_cache_size = 8ft_min_word_len = 4log_bin = mysql-binbinlog_format = mixedlog_error = /usr/local/software/mysql/data/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = /usr/local/software/mysql/data/mysql-slow.logperformance_schema = 0explicit_defaults_for_timestampskip-external-lockingdefault_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800[mysqldump]quickmax_allowed_packet = 16M[myisamchk]key_buffer_size = 8Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4M
[root@ecs-steven mysql-5.7.13]# /usr/local/software/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql --basedir=/usr/local/software/mysql --datadir=/usr/local/software/mysql/data
mysqld_safe is the recommended way to start a mysqld server on Unix. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log.
From 4.3.2 mysqld_safe — MySQL Server Startup Script, MySQL 8.0 Reference Manual
# 啟動[root@ecs-steven mysql-8.0.12]# /usr/local/software/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &[1] 19351[root@ecs-steven mysql-8.0.12]# Logging to '/usr/local/software/mysql/data/mysql-error.log'.2018-09-21T08:51:39.325794Z mysqld_safe Starting mysqld daemon with databases from /usr/local/software/mysql/data# 關閉[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysqladmin shutdown2018-09-22T01:48:11.500105Z mysqld_safe mysqld from pid file /usr/local/software/mysql/data/mysql.pid ended
$ /usr/local/software/mysql/bin/mysql -uroot
MySQL 第一次安裝完成后,是沒有設置 root 密碼的,直接回車 Enter 即可登陸:
10.1 修改 root 賬號密碼
mysql -u rootmysql> use mysql;mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your password';Query OK, 0 rows affected (0.01 sec)# 我們也可以通過該命令直接重置 root 賬號密碼
mysql> select user,host from mysql.user;+------------------+-----------+| user | host |+------------------+-----------+| mysql.infoschema | localhost || mysql.session | localhost || mysql.sys | localhost || root | localhost |+------------------+-----------+4 rows in set (0.00 sec)mysql>
① mysqladmin 關閉失敗
[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysqladmin shutdownmysqladmin: connect to server at 'localhost' failederror: 'Access denied for user 'root'@'localhost' (using password: NO)'
② 停止 mysql 服務
[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysqld stop # 不起作用[root@ecs-steven ~]# kill -9 processes
③ 安全模式啟動
[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --skip-grant-tables &[1] 26389[root@ecs-steven ~]# 2018-11-15T03:10:48.938826Z mysqld_safe Logging to '/usr/local/software/mysql/data/mysql-error.log'.2018-11-15T03:10:48.973639Z mysqld_safe Starting mysqld daemon with databases from /usr/local/software/mysql/data
④ 無密碼 root 賬號登陸
[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysql -uroot#在下面的要求你輸入密碼的時候,你不用管,直接回車鍵一敲就過去了Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 7Server version: 8.0.12 Source distributionCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
⑤ 修改密碼,重新登陸
mysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your new password';Query OK, 0 rows affected (0.01 sec)mysql> \qBye# 重新登陸測試[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 14Server version: 8.0.12 Source distributionCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
⑥ 正常重新啟動
[root@ecs-steven mysql]# /usr/local/software/mysql/bin/mysqladmin shutdown -uroot -pEnter password:2018-11-15T06:48:33.125907Z mysqld_safe mysqld from pid file /usr/local/software/mysql/data/mysql.pid ended[1]+ Done /usr/local/software/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql (wd: ~)(wd now: /usr/local/software/mysql)[root@ecs-steven ~]# /usr/local/software/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &[1] 29368[root@ecs-steven ~]# 2018-11-15T03:36:28.876747Z mysqld_safe Logging to '/usr/local/software/mysql/data/mysql-error.log'.2018-11-15T03:36:28.910624Z mysqld_safe Starting mysqld daemon with databases from /usr/local/software/mysql/data
注意:如果是使用免安裝版本的 MySQL,需要補充 mysql.server 文件中的 basedir 和 datadir:
basedir=/usr/local/software/mysqldatadir=/usr/local/software/mysql/data
設置 MySQL 開機啟動:
[root@ecs-steven ~]# ls -lrt /usr/local/software/mysql[root@ecs-steven ~]# cp /usr/local/software/mysql/support-files/mysql.server /etc/init.d/mysqld[root@ecs-steven ~]# chmod +x /etc/init.d/mysqld[root@ecs-steven ~]# systemctl enable mysqldmysqld.service is not a native service, redirecting to /sbin/chkconfig.Executing /sbin/chkconfig mysqld on
啟動數(shù)據(jù)庫:
[root@ecs-steven ~]# systemctl start mysqld[root@ecs-steven ~]# systemctl status mysqld
查看 MySQL 服務進程和端口:
[root@ecs-steven ~]# ps -ef | grep mysql[root@ecs-steven ~]# netstat -tunpl | grep 3306
參考資料:
Blast2GO Command Line User Manual - Version 1.1 October 2015
anlan,blast2go 本地化,生信技能樹
蝸牛,CentOS 7 安裝并配置 MySQL 5.6,博客園
JagoWang,mysql 重置 root 密碼及相關問題,GitHub
Mariana Monteiro,Local Blast2GO Database Installation,Blast2GO Blog
2.10.4 Securing the Initial MySQL Account,MySQL 8.0 Reference Manual
B.5.3.2 How to Reset the Root Password,MySQL 8.0 Reference Manual
黃杉,MySQL root 密碼重置報錯:mysqladmin: connect to server at ‘localhost’ failed 的解決方案,CSD
聯(lián)系客服