ubuntu kylin 14.10下多個(gè)mysql 5.7.14安裝教程
前文已述,因?yàn)樾枰獪y(cè)試mysql的主從配置方案,所以要安裝多個(gè)mysql。這次是在ubuntu kylin 14.10上安裝多個(gè)mysql 5.7.14。
系統(tǒng)環(huán)境:ubuntu kylin 14.10,64位系統(tǒng)
mysql版本:5.7.14社區(qū)版
mysql下載地址:http://dev.mysql.com/downloads/mysql/,選擇 Linux - Generic,下載612.9M的mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
mysql官方安裝文檔:http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html1.按照官方安裝文檔進(jìn)行即可,只是一些shell命令做了修改,對(duì)ubuntu來(lái)說(shuō),大部分命令都需要在前面增加sudo
shell> sudo groupadd mysql shell> sudo useradd -r -g mysql -s /bin/false mysql shell> cd /usr/local shell> sudo tar -zxvf /path/to/mysql-VERSION-OS.tar.gz shell> sudo mv mysql-5.7.14-linux-glibc2.5-x86_64 mysql-5.7.14-linux-glibc2.5-x86_64-3306 #將mysql的目錄改了一下名 shell> sudo ln -s mysql-5.7.14-linux-glibc2.5-x86_64-3306 mysql-3306 shell> cd mysql-3306 shell> sudo mkdir mysql-files shell> sudo chmod 750 mysql-files shell> sudo chown -R mysql:mysql . shell> sudo cp support-files/my-default.cnf ./my.cnf #copy一份my.cnf 接著編輯my.cnf,打開(kāi)basedir,datadir,port等項(xiàng),按如下配置: basedir = /usr/local/mysql-3306 datadir = /usr/local/mysql-3306/data port = 3306 server_id = 11 然后開(kāi)始初始化3306端口上的mysql: shell> sudo bin/mysqld --defaults-file=/usr/local/mysql-3306/my.cnf --initialize --user=mysql 2016-07-29T15:38:48.896585Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-07-29T15:38:48.896672Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2016-07-29T15:38:48.896682Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2016-07-29T15:38:50.498675Z 0 [Warning] InnoDB: New log files created, LSN=45790 2016-07-29T15:38:50.890849Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2016-07-29T15:38:51.062752Z 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: 8c708a13-55a2-11e6-835e-a0481ced538c. 2016-07-29T15:38:51.088854Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2016-07-29T15:38:51.090179Z 1 [Note] A temporary password is generated for root@localhost: pJLwjf%q;1t) shell> sudo bin/mysql_ssl_rsa_setup --defaults-file=/usr/local/mysql-3306/my.cnf Generating a 2048 bit RSA private key .........+++ .......................+++ writing new private key to 'ca-key.pem' ----- Generating a 2048 bit RSA private key ..........+++ ..............................................................+++ writing new private key to 'server-key.pem' ----- Generating a 2048 bit RSA private key ................................................+++ ........................................+++ writing new private key to 'client-key.pem' ----- shell> sudo chown -R root . shell> sudo chown -R mysql data mysql-files shell> sudo bin/mysqld_safe --user=mysql & #啟動(dòng)mysql,在后臺(tái)運(yùn)行 # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
2.開(kāi)始登錄mysql進(jìn)行相關(guān)操作
/usr/local/mysql-3306> bin/mysql -uroot -p
注意在執(zhí)行bin/mysqld初始化時(shí),在命令行最后的提示中給出了一個(gè)臨時(shí)口令,輸入之后即可登錄。登錄mysql之后,要求立即修改密碼,否則不能進(jìn)行任何操作。執(zhí)行下面的命令修改'root'@'localhost'的密碼:
mysql> SET PASSWORD = PASSWORD('your new password'); mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; mysql> flush privileges;
為了可以遠(yuǎn)程登錄,增加一個(gè)'root'@'%'賬號(hào):
3.按照上面的辦法,繼續(xù)解壓安裝mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz,并且配置為3307,3308,3309端口,就可以安裝多個(gè)mysql了。
精彩專題分享:mysql不同版本安裝教程 mysql5.7各版本安裝教程
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Mysql 直接查詢存儲(chǔ)的Json字符串中的數(shù)據(jù)
本文主要介紹了Mysql直接查詢存儲(chǔ)的Json字符串中的數(shù)據(jù),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02淺談MySQL數(shù)據(jù)庫(kù)崩潰(crash)的常見(jiàn)原因和解決辦法
本文主要介紹了淺談MySQL數(shù)據(jù)庫(kù)崩潰(crash)的常見(jiàn)原因和解決辦法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-03-03帶你學(xué)習(xí)MySQL執(zhí)行計(jì)劃
前面文章,我們學(xué)習(xí)了 MySQL 慢日志相關(guān)內(nèi)容,當(dāng)我們篩選得到具體的慢 SQL 后,就要想辦法去優(yōu)化啦。優(yōu)化 SQL 的第一步應(yīng)該是讀懂 SQL 的執(zhí)行計(jì)劃。本篇文章,我們一起來(lái)學(xué)習(xí)下 MySQL explain 執(zhí)行計(jì)劃相關(guān)知識(shí)。2021-05-05mysql使用教程之分區(qū)表的使用方法(刪除分區(qū)表)
mysql分區(qū)表使用方法,新增分區(qū)、刪除分區(qū)、分區(qū)的合并、分區(qū)的拆分等使用方法2013-12-12MySQL中ADD?COLUMN添加多個(gè)字段的寫(xiě)法實(shí)例
這篇文章主要給大家介紹了關(guān)于MySQL中ADD?COLUMN添加多個(gè)字段的寫(xiě)法實(shí)例,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2023-02-02mysql表的內(nèi)連和外連實(shí)戰(zhàn)記錄
在開(kāi)發(fā)中我們的業(yè)務(wù)需求有時(shí)候是復(fù)雜的,多張表聯(lián)合查詢的時(shí)候是有多種方式的,面對(duì)不同的需求,靈活使用不同的表連接方式,這篇文章主要給大家介紹了關(guān)于mysql表內(nèi)連和外連的相關(guān)資料,需要的朋友可以參考下2024-01-01