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 fabric搭建_MySQL Fabric 安装部署
MySQL Fabric 是一个用于管理 MySQL 服务器群的可扩展框架.该框架实现了两个特性 - 高可用性 (HA) 以及使用数据分片的横向扩展.这两个特性既可以单独使用,也可以结合使用. 环境: ...
- 升级mysql服务器二进制备份_MySQL二进制日志备份和恢复详解
基本概念 定义: 二进制日志包含了所有更新了数据或者已经潜在更新了数据(例如,没有匹配任何行的一个DELETE)的所有语句. 作用: 1.二进制日志的主要目的是在恢复使能够最大可能地更新数据库,因为二 ...
- mysql官网二进制包_mysql二进制包安装与配置实战记录
1 1.安装之前,先创建mysql用户 [root@linuxprobe_nfs ~]# useradd mysql -s /sbin/nologin -M [root@linuxprobe_nfs ...
- mysql5.7.76安装,MySQL 5.7.30 的安装/升级(所有可能的坑都在这里)
楔子 由于之前电脑上安装的MySQL版本是比较老的了,大概是5.1的版本,不支持JSON字段功能.而最新开发部门开发的的编辑器产品,使用到了JSON字段的功能. 因此需要升级MySQL版本,升级的目标 ...
- 订阅mysql的二进制日志_MySQL二进制日志
一.二进制日志(The Binary Log) 1.简介 包含所有更新了的数据或者已经潜在更新了的数据(比如一条没有匹配任何行的delete语句) 包含所有更新语句执行时间的信息 不记录没有修改数据的 ...
- mysql 大二进制类型_MySql 二进制类型
MySQL二进制类型 二进制类型是在数据库中存储二进制数据的数据类型.二进制类型包括BINARY.VARBINARY.BIT.TINYBLOB.BLOB.MEDIUMBLOB和LONGBLOB等. M ...
- discuz php升级,DiscuzX 论坛安装升级
DiscuzX安装: 系统环境:linux 系统架构:最前端两台Nginx使用Keepalived来实现高可用和负载均衡然后使用这两台Nginx来发布后端的多个应用,后端包括Tomcat和PHP环境 ...
- mysql 一键脚本_mysql一键安装脚本
#!/bin/bash#本脚本用于一键安装mysql,cmake-3.0.1.tar.gz和mysql-5.5.37.tar.gz需要放在同一目录useraddmysqltar-zvxfcmake-3 ...
- mysql的编译_Mysql编译安装
Mysql编译安装 创建目录 [root@db02 ~]# mkdir /server/tools -p 进入目录 [root@db02 ~]# cd /server/tools/ 上传mysql源码 ...
最新文章
- windows兼容Linux php,支持windows与linux的php计划任务的实现方法
- 教你怎么样在 Java8 中优雅的避开空指针异常
- 如何解一元一次方程视频_七年级数学教学视频-小邵课堂
- android lame wav 转 mp3,Android JNI Lame编解码实现wav到MP3的转换
- antd design form表单手动处理错误
- 数据库面试 - 如何设计才可以让系统从未分库分表动态切换到分库分表上?
- 让你的IE浏览器支持HTML5标准方法代码
- CleanMyMac偏好设置你知道多少?
- 程序员的一种境界【转的】
- python机器学习-乳腺癌细胞挖掘(基于真实美国临床数据)
- foxmail邮箱怎么导入邮件_将Foxmail邮件智能导入Outlook
- WINDOWS更改无线网卡MAC地址的方法
- AtCoder Beginner Contest 242 C 1111gal password
- python语言玫瑰花_python 实现漂亮的烟花,樱花,玫瑰花
- 第2节--深度学习基础介绍-机器学习--课程介绍(下)
- 计算机主机的拆卸步骤,电脑清灰详细图文教程解说
- GBase 8a 核心服务组件功能简介
- 实验9 人口预测与数据拟合(最小二乘法)
- Centos 6下载地址
- STM32从零到一,从标准库移植到HAL库,UART串口1以DMA模式收发不定长数据代码详解+常见问题 一文解析
热门文章
- SQL基础【十八、事物】(sql事物慎用,还是写业务逻辑代码好一些,入伙涉及到更换数据啥的很麻烦!)
- error while loading shared libraries: xxx.so.x错误的原因和解决办法
- 数据库表及字段命名、设计规范
- TypeScript 参数属性
- 「HDU6579 Operation」 - 线性基
- 利用管道实现进程间通信
- 静态库与动态库(一):概述
- .net得到ip(引)
- 测试综合技能的期末预测
- Java黑皮书课后题第10章:**10.27(实现StringBuffer类)在Java库中提供了StringBuffer类,给胡你自己对下面方法的实现(将新类命名为MyStringBuilder1)