mysql二进制升级_MySQL二进制安装,升级,多实例部署
MySQL二進制安裝,升級,多實例部署
目標
理解線上部署考慮的因素
學會編譯安裝以及二進制安裝mysql
學會升級mysql
學會多實例部署mysql數據庫
學會合理部署mysql線上庫
考慮因素:
版本選擇,5.1,5.5還是5.6?
分支選擇,官方社區版?percona server?mariadb?
推薦官方版,簡單易上手
安裝方式,包安裝?二進制包安裝?源碼安裝?
線上推薦二進制包安裝
路徑配置,參數配置(盡量模板化,標準化)
一個實例多個庫,or多個實例單個庫?
二進制安裝mysql
下載軟件安裝包
解壓放到指定目錄(比如/usr/local)并將mysql目錄放到PATH中
初始化實例,編輯配置文件 并啟動
賬號安全設置
1)下載
2)解壓到指定目錄,并將mysql目錄放到PATH中
#tar -zxf mysql-5.5.50-linux2.6-i686.tar.gz
#mv mysql-5.5.50-linux2.6-i686 /usr/local/#cd/usr/local
#mv mysql-5.5.50-linux2.6-i686 mysql55
#cd mysql55/bin
#export PATH=/usr/local/mysql55/bin:$PATH
3)初始化實例 使用腳本mysql_install_db
#mkdir -p /tmp/mysqldata/node1
#/usr/local/mysql55/script/mysql_install_db --user=mysql --basedir=/usr/local/mysql55 --datadir=/tmp/mysqldata/node1
#cd/tmp/mysqldata/node1
出現問題1 沒有libaio.so.1庫
/tmp/mysql55/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解決:查詢libaio庫并按照libaio.so.1
查詢
linuxidc@linuxidc:/tmp$ sudo apt-cache search libaio
libaio-dev - Linux kernel AIO access library -development files
libaio1- Linux kernel AIO access library -shared library
libaio1-dbg - Linux kernel AIO access library - debugging symbols
安裝
linuxidc@linuxidc:/tmp$ sudo apt-get install libaio1
初始化成功:
linuxidc@linuxidc:/usr/local/mysql/data$ ls -l /tmp/mysqldata/node1/total12drwx------ 2 linuxidc linuxidc 4096 7月 27 21:27mysql
drwx------ 2 linuxidc linuxidc 4096 7月 27 21:27performance_schema
drwx------ 2 linuxidc linuxidc 4096 7月 27 21:25 test
拷貝配置文件:support-files中拷貝my-medium.cnf
cp /usr/local/mysql56/support-files/my-medium.cnf /tmp/mysqldata
3)使用mysqld_safe腳本,啟動
/usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &
問題2:沒有/usr/local/mysql/data 目錄
linuxidc@linuxidc:/usr/local/mysql55/support-files$ /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &[1] 3349linuxidc@linuxidc:/usr/local/mysql55/support-files$ 160727 21:33:26 mysqld_safe Logging to '/usr/local/mysql/data/linuxidc.err'.touch: cannot touch ‘/usr/local/mysql/data/linuxidc.err’: No such fileor directorychmod: cannot access ‘/usr/local/mysql/data/linuxidc.err’: No such fileor directory160727 21:33:26 mysqld_safe The file /usr/local/mysql/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information
/usr/local/mysql55/bin/mysqld_safe: 128: /usr/local/mysql55/bin/mysqld_safe: cannot create /usr/local/mysql/data/linuxidc.err: Directory nonexistent^C
[1]+? Exit 1? ? ? ? ? ? ? ? ? /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
View Code
解決:創建目錄并賦權
linuxidc@linuxidc:/usr/local$ sudo mkdir -p mysql/data
linuxidc@linuxidc:/usr/local/mysql$ sudo chown -R linuxidc .
linuxidc@linuxidc:/usr/local/mysql$ sudo chgrp -R linuxidc .
問題3:不存/usr/local/mysql/bin/mysqld 文件
linuxidc@linuxidc:/usr/local/mysql$ /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &[1] 3773linuxidc@linuxidc:/usr/local/mysql$ 160727 21:37:32 mysqld_safe Logging to '/usr/local/mysql/data/linuxidc.err'.160727 21:37:32 mysqld_safe The file /usr/local/mysql/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information
^C
[1]+ Exit 1 /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
View Code
懷疑 Ubuntu定死了basedir 在/usr/local/mysql 下
解決:拷貝mysql55中內容到該目錄中
linuxidc@linuxidc:/usr/local/mysql$ cp -ar ../mysql55/*.
問題4:mysqld從 /usr/local/mysql/data中啟動庫文件;
linuxidc@linuxidc:/usr/local/mysql$ /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &[1] 3983linuxidc@linuxidc:/usr/local/mysql$ 160727 21:39:05 mysqld_safe Logging to '/usr/local/mysql/data/linuxidc.err'.160727 21:39:05 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data160727 21:39:07 mysqld_safe mysqld from pid file /usr/local/mysql/data/linuxidc.pid ended
[1]+? Done? ? ? ? ? ? ? ? ? ? /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
且mysqld沒有啟動
linuxidc@linuxidc:~$ ps -ef | grepmysqld
linuxidc2129? 2097? 0 19:35 pts/2? ? 00:00:00 grep --color=auto mysqld
查看linuxidc.err:需要的一些表不在/usr/local/mysql/data
160727 21:41:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data160727 21:41:59 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.50-log) starting as process 4500...160727 21:41:59 [Note] Plugin 'FEDERATED'is disabled./usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
160727 21:41:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160727 21:41:59InnoDB: The InnoDB memory heap is disabled160727 21:41:59InnoDB: Mutexes and rw_locks use GCC atomic builtins160727 21:41:59 InnoDB: Compressed tables use zlib 1.2.3
160727 21:41:59InnoDB: Using Linux native AIO160727 21:41:59 InnoDB: Initializing buffer pool, size = 128.0M
160727 21:41:59InnoDB: Completed initialization of buffer pool160727 21:41:59 InnoDB: highest supported fileformat is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn48941
160727 21:41:59 InnoDB: Database was not shut down normally!InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number1595675
160727 21:41:59InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progressin percents: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99InnoDB: Apply batch completed160727 21:41:59 InnoDB: Waiting forthe background threads to start160727 21:42:00 InnoDB: 5.5.50 started; log sequence number 1595675
160727 21:42:00 [Note] Recovering after a crash using mysql-bin160727 21:42:00[Note] Starting crash recovery...160727 21:42:00[Note] Crash recovery finished.160727 21:42:00 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160727 21:42:00 [Note] - '0.0.0.0' resolves to '0.0.0.0';160727 21:42:00 [Note] Server socket created on IP: '0.0.0.0'.160727 21:42:00 [ERROR] Fatal error: Can't open and lock privilege tables: Table'mysql.host'doesn't exist160727 21:42:00 mysqld_safe mysqld from pid file /usr/local/mysql/data/linuxidc.pid ended
View Code
解決:將原初始化的datadir目錄中所有拷貝過去
linuxidc@linuxidc:/usr/local/mysql/data$ rm -rf test/linuxidc@linuxidc:/usr/local/mysql/data$ cp -ar /tmp/mysqldata/node1/*.
成功安裝:
linuxidc@linuxidc:/usr/local/mysql/data$ ps -ef | grepmysqld
linuxidc4536 2146 0 21:43 pts/0 00:00:00 /bin/sh /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
linuxidc4773 4536 1 21:43 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/tmp/mysqldata/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/linuxidc.err --pid-file=/usr/local/mysql/data/linuxidc.pid --socket=/tmp/mysql.sock --port=3306linuxidc4792 2097 0 21:44 pts/2 00:00:00 grep --color=auto mysqld
View Code
疑問:
不知是Ubuntu指定了basedir=/usr/local/mysql,datadir=/usr/local/mysql/data;還是最開始的初始化沒有管用,還是有什么配置沒有寫在配置文件中。
當然是沒有寫在配置文件中了,可以查看一下my-medium.cnf內容
[client]
#password=your_password
port= 3306socket= /tmp/mysql.sock
# Here follows entriesforsome specific programs
# The MySQL server
[mysqld]
port= 3306socket= /tmp/mysql.sock
skip-external-locking
key_buffer_size=16M
max_allowed_packet=1M
table_open_cache= 64sort_buffer_size=512K
net_buffer_length=8K
read_buffer_size=256K
read_rnd_buffer_size=512K
myisam_sort_buffer_size= 8M
View Code
沒有相關目錄的配置;
在my.cnf 增加一下配置
my.cnf
port= 3306socket= /tmp/mysqldata/node1/mysql.sock
[mysqld_safe]
user=linuxidc
# Here follows entriesforsome specific programs
# The MySQL server
[mysqld]
port= 3306socket= /tmp/mysqldata/node1/mysql.sock
pid-file = /tmp/mysqldata/node1/mysqld.pid
basedir= /usr/local/mysql55
datadir= /tmp/mysqldata/node1
innodb_data_home_dir= /tmp/mysqldata/node1
innodb_log_group_home_dir=/tmp/mysqldata/node1
tmpdir= /tmp/mysqldata/node1
log-error = /tmp/mysqldata/node1/linuxidc.log
log-bin = /tmp/mysqldata/node1/mysql-bin.log
View Code
重新啟動
問題一:配置文件權限太大
linuxidc@linuxidc:/usr/local/mysql$ /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &Warning: World-writable config file '/tmp/mysqldata/my.cnf' is ignored
解決:降權
linuxidc@linuxidc:sudo chmod 600 /tmp/mysqldata/my.cnf
問題二:bin目錄未指定
linuxidc@linuxidc:/usr/local/mysql$ /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &
160806 16:07:29 mysqld_safe The file /usr/local/mysql/bin/mysqld does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows: ./bin/mysqld_safe&
解決:在配置文件中通過ledir指定bin目錄
#my.cnf增加
ledir= /usr/local/mysql55
問題三:linuxidc.err報錯,插件被禁止
160806 16:48:46 [Note] Plugin 'FEDERATED'is disabled.160806 16:48:46InnoDB: The InnoDB memory heap is disabled160806 16:48:46InnoDB: Mutexes and rw_locks use GCC atomic builtins160806 16:48:46 InnoDB: Compressed tables use zlib 1.2.3
160806 16:48:46InnoDB: Using Linux native AIO160806 16:48:46 InnoDB: Initializing buffer pool, size = 128.0M
View Code
解決:在配置文件中啟用,nice=0
#my.cnf增加nice = 0
4)賬號安全設置
#刪除空用戶
mysql -uroot --socket=/tmp/mysql.sockselectuser,host,password from mysql.user;
delete from mysql.user where user='';
delete from mysql.user where host<>'localhost';
mysql> selectuser,host,password from mysql.user;+------+-----------+----------+
| user | host | password |
+------+-----------+----------+
| root | localhost | |
+------+-----------+----------+
1 row in set (0.00 sec)
#設置root密碼
mysql> set password for root@'localhost'=password('000000');
Query OK,0 rows affected (0.00 sec)
#使設置生效
flush privileges;
#刪除test庫
看看只讀權限的test用戶能用test庫做什么
創建test用戶
#mysql-uroot -p123456--socket=/tmp/mysql.sock
grantselect on *.* to test@'localhost' identified by '123';
使用test用戶,在test庫中建表
#mysql-utest -p123 --socket=/tmp/mysql.sock
use test
create table t1(id int);
mysql>show tables;+----------------+
| Tables_in_test |
+----------------+
| t1 |
+----------------+
1 row in set (0.01 sec)
刪除test庫
mysql>drop database test;
Query OK,1 row affected (0.01 sec)
mysql升級
從5.5升級到5.6
下載mysql5.6安裝包并配置mysql5.6安裝包安裝路徑
關閉mysql5.5的實例,修改部分參數,使用mysql5.6軟件啟動
執行mysql5.6路徑下mysql_upgrade腳本
驗證是否成功升級
MySQL升級
1)關閉mysql
查看mysql是否啟動
linuxidc@linuxidc:/tmp/mysqldata$ ps -ef | grepmysqld
linuxidc4931 2146 0 22:32 pts/0 00:00:00 /bin/sh /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
linuxidc5168 4931 0 22:32 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/tmp/mysqldata/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/linuxidc.err --pid-file=/usr/local/mysql/data/linuxidc.pid --socket=/tmp/mysql.sock --port=3306linuxidc5187 4889 0 22:33 pts/13 00:00:00 grep --color=auto mysqld
使用mysqladmin工具關閉mysql服務
linuxidc@linuxidc:/usr/local/mysql$ mysqladmin -uroot --socket=/tmp/mysql.sock shutdown -p
Enter password:160727 22:28:46 mysqld_safe mysqld from pid file /usr/local/mysql/data/linuxidc.pid ended
[1]+ Done /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf (wd: /usr/local/mysql/data)
(wd now:/usr/local/mysql)
檢查是否關閉
linuxidc@linuxidc:/usr/local/mysql$ ps -ef | grepmysqld
linuxidc4918 2146 0 22:28 pts/0 00:00:00 grep --color=auto mysqld
2)更改my.cnf
#vim my.cnf(把55目錄都改成56的)
3)使用mysql5.6啟動軟件;
#使用5.6拉起實例
linuxidc@linuxidc:/tmp/mysqldata$ /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf &[1] 9121linuxidc@linuxidc:/tmp/mysqldata$ 160806 21:29:11 mysqld_safe Logging to '/tmp/mysqldata/node1/linuxidc.log'.160806 21:29:11 mysqld_safe Starting mysqld daemon with databases from /tmp/mysqldata/node1
#查看mysqld進程有沒有起來
linuxidc@linuxidc:/tmp/mysqldata$ ps -ef | grepmysql
linuxidc9121 8547 0 21:29 pts/2 00:00:00 /bin/sh /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
linuxidc9489 9121 0 21:29 pts/2 00:00:00 /usr/local/mysql56/bin/mysqld --defaults-file=/tmp/mysqldata/my.cnf --basedir=/usr/local/mysql56 --datadir=/tmp/mysqldata/node1 --plugin-dir=/usr/local/mysql56/lib/plugin --log-error=/tmp/mysqldata/node1/linuxidc.log --pid-file=/tmp/mysqldata/node1/mysqld.pid --socket=/tmp/mysqldata/node1/mysql.sock --port=3306linuxidc9564 8547 0 21:35 pts/2 00:00:00 grep --color=auto mysql
#登陸后查看mysql狀態
mysql>status--------------mysql Ver14.14 Distrib 5.6.32, for linux-glibc2.5(x86_64) using EditLine wrapper
Connectionid: 3Current database:
Current user: root@localhost
SSL: Notinuse
Current pager: stdout
Using outfile:''Using delimiter: ;
Server version:5.6.32-log MySQL Community Server (GPL)
Protocol version:10Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket:/tmp/mysqldata/node1/mysql.sock
Uptime:7 min 27sec
Threads:1 Questions: 5 Slow queries: 0 Opens: 32 Flush tables: 1 Open tables: 25 Queries per second avg: 0.011
--------------
4)升級庫mysql_upgrade
linuxidc@linuxidc:/tmp/mysqldata$ /usr/local/mysql56/bin/mysql_upgrade -uroot --socket=/tmp/mysqldata/node1/mysql.sock -p
Enter password:
Lookingfor 'mysql' as: /usr/local/mysql56/bin/mysql
Lookingfor 'mysqlcheck' as: /usr/local/mysql56/bin/mysqlcheck
Running'mysqlcheck' with connection arguments: '--socket=/tmp/mysqldata/node1/mysql.sock'Warning: Using a password on the command line interface can be insecure.
Running'mysqlcheck' with connection arguments: '--socket=/tmp/mysqldata/node1/mysql.sock'Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Running'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running'mysqlcheck' with connection arguments: '--socket=/tmp/mysqldata/node1/mysql.sock'Warning: Using a password on the command line interface can be insecure.
Running'mysqlcheck' with connection arguments: '--socket=/tmp/mysqldata/node1/mysql.sock'Warning: Using a password on the command line interface can be insecure.
OK
View Code
#驗證庫有沒有升級成功
linuxidc@linuxidc:/tmp/mysqldata$ /usr/local/mysql56/bin/mysql_upgrade -uroot --socket=/tmp/mysqldata/node1/mysql.sock -p
Enter password:
Lookingfor 'mysql' as: /usr/local/mysql56/bin/mysql
Lookingfor 'mysqlcheck' as: /usr/local/mysql56/bin/mysqlcheck
This installation of MySQL is already upgraded to5.6.32, use --force if you still need to run mysql_upgrade
mysql多實例安裝
部署好mysql軟件
編輯多個配置文件,初始化多個實例
啟動mysql實例
為啥多實例部署?
充分利用系統資源
資源隔離
業務,模塊隔離
多實例安裝
#mkdir -p /mysqldata/node3
a) 初始化實例 使用腳本mysql_install_db
linuxidc@linuxidc:/tmp/mysqldata/node1$ /usr/local/mysql56/scripts/mysql_install_db --user=linuxidc --basedir=/usr/local/mysql56 --datadir=/tmp/mysqldata/node3
#查看
linuxidc@linuxidc:/tmp/mysqldata/node1$ ls ../node3
ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema test
b) 給node3配置文件
cpmy2.cnf my3.cnf
vim my3.cnf(修改相關參數)
[client]
#password=your_password
port= 3308socket= /tmp/mysqldata/node3/mysql.sock
[mysqld_safe]
user=linuxidc
ledir= /usr/local/mysql56/bin
#ledir= /usr/local/mysql55/binnice = 0# Here follows entriesforsome specific programs
# The MySQL server
[mysqld]
port= 3308socket= /tmp/mysqldata/node3/mysql.sock
pid-file = /tmp/mysqldata/node3/mysqld.pid
basedir= /usr/local/mysql56
#basedir= /usr/local/mysql55
datadir= /tmp/mysqldata/node3
innodb_data_home_dir= /tmp/mysqldata/node3
innodb_log_group_home_dir= /tmp/mysqldata/node3
tmpdir= /tmp/mysqldata/node3
log-error = /tmp/mysqldata/node3/linuxidc.log
log-bin = /tmp/mysqldata/node3/mysql-bin.log
c) 使用mysqld_safe,及my3.cnf拉起實例
linuxidc@linuxidc:/tmp/mysqldata/node3$ /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/node3/my3.cnf &[2] 9861linuxidc@linuxidc:/tmp/mysqldata/node3$ 160806 22:03:17 mysqld_safe Logging to '/tmp/mysqldata/node3/linuxidc.log'.160806 22:03:17 mysqld_safe Starting mysqld daemon with databases from /tmp/mysqldata/node3
d)查看
linuxidc@linuxidc:/tmp/mysqldata/node3$ ps -ef | grepmysqld
linuxidc9121 8547 0 21:29 pts/2 00:00:00 /bin/sh /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnf
linuxidc9489 9121 0 21:29 pts/2 00:00:02 /usr/local/mysql56/bin/mysqld --defaults-file=/tmp/mysqldata/my.cnf --basedir=/usr/local/mysql56 --datadir=/tmp/mysqldata/node1 --plugin-dir=/usr/local/mysql56/lib/plugin --log-error=/tmp/mysqldata/node1/linuxidc.log --pid-file=/tmp/mysqldata/node1/mysqld.pid --socket=/tmp/mysqldata/node1/mysql.sock --port=3306linuxidc9861 8547 0 22:03 pts/2 00:00:00 /bin/sh /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/node3/my3.cnf
linuxidc10327 9861 0 22:03 pts/2 00:00:00 /usr/local/mysql56/bin/mysqld --defaults-file=/tmp/mysqldata/node3/my3.cnf --basedir=/usr/local/mysql56 --datadir=/tmp/mysqldata/node3 --plugin-dir=/usr/local/mysql56/lib/plugin --log-error=/tmp/mysqldata/node3/linuxidc.log --pid-file=/tmp/mysqldata/node3/mysqld.pid --socket=/tmp/mysqldata/node3/mysql.sock --port=3308linuxidc10350 8547 0 22:04 pts/2 00:00:00 grep --color=auto mysqld
可以看到有兩個端口的mysqld,分別是3306,3308;
e) 登陸新實例,刪除test庫,空用戶,設置root密碼
linuxidc@linuxidc:/tmp/mysqldata/node3$ mysql -uroot --socket=/tmp/mysqldata/node3/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connectionid is 1Server version:5.6.32-log MySQL Community Server (GPL)
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 clearthe current input statement.
delete from msyql.user where user='';
delete from mysql.user where host<>'localhost';
set passwordfor root@'localhost'=password('000000');
delete from mysql.db;
drop database test;
flush privileges;
View Code
mysql線上安裝小結
根據需求選擇合適的版本以及分支,建議使用或升級到較高版本5.5或5.6
如果需要定制mysql功能的話,可以考慮編譯安裝,否則的話建議使用二進制包安裝,比較省事。
根據機器配置選擇部署多個mysql實例還是單個實例,機器配置非常好的話,建議部署多實例
總結
以上是生活随笔為你收集整理的mysql二进制升级_MySQL二进制安装,升级,多实例部署的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql 执行计划 代价_mysql
- 下一篇: redis mysql 下载_redis