Welcome 微信登录

首页 / 数据库 / MySQL / MySQL二进制安装,升级,多实例部署

MySQL二进制安装,升级,多实例部署目标
  • 理解线上部署考虑的因素
  • 学会编译安装以及二进制安装mysql
  • 学会升级mysql
  • 学会多实例部署mysql数据库
  • 学会合理部署mysql线上库
考虑因素:
  • 版本选择,5.1,5.5还是5.6?
  • 分支选择,官方社区版?percona server?mariadb?
    • 推荐官方版,简单易上手
  • 安装方式,包安装?二进制包安装?源码安装?
    • 线上推荐二进制包安装
  • 路径配置,参数配置(尽量模板化,标准化)
  • 一个实例多个库,or多个实例单个库?
二进制安装mysql
  1. 下载软件安装包
  2. 解压放到指定目录(比如/usr/local)并将mysql目录放到PATH中
  3. 初始化实例,编辑配置文件 并启动
  4. 账号安全设置
1)下载mysql-5.5.50-linux2.6-i6862)解压到指定目录,并将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:$PATH3)初始化实例 使用脚本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 libaiolibaio-dev - Linux kernel AIO access library - development fileslibaio1 - Linux kernel AIO access library - shared librarylibaio1-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/total 12drwx------ 2 linuxidc linuxidc 40967月 27 21:27 mysqldrwx------ 2 linuxidc linuxidc 40967月 27 21:27 performance_schemadrwx------ 2 linuxidc linuxidc 40967月 27 21:25 test拷贝配置文件:support-files中拷贝my-medium.cnfcp /usr/local/mysql56/support-files/my-medium.cnf /tmp/mysqldata3)使用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] 3349
linuxidc@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 file or directory
chmod: cannot access ‘/usr/local/mysql/data/linuxidc.err’: No such file or directory
160727 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.cnfView Code解决:创建目录并赋权linuxidc@linuxidc:/usr/local$ sudo mkdir -p mysql/datalinuxidc@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/mysqlddoes not exist or is not executable. Please cd to the mysql installationdirectory 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.cnfView 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] 3983
linuxidc@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/data
160727 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 | grep mysqld
linuxidc 2129  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 exist160727 21:41:59 [ERROR] Can"t open the mysql.plugin table. Please run mysql_upgrade to create it.160727 21:41:59 InnoDB: The InnoDB memory heap is disabled160727 21:41:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins160727 21:41:59 InnoDB: Compressed tables use zlib 1.2.3160727 21:41:59 InnoDB: Using Linux native AIO160727 21:41:59 InnoDB: Initializing buffer pool, size = 128.0M160727 21:41:59 InnoDB: Completed initialization of buffer pool160727 21:41:59 InnoDB: highest supported file format is Barracuda.InnoDB: Log scan progressed past the checkpoint lsn 48941160727 21:41:59InnoDB: 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 doublewriteInnoDB: buffer...InnoDB: Doing recovery: scanned up to log sequence number 1595675160727 21:41:59InnoDB: Starting an apply batch of log records to the database...InnoDB: Progress in 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:59InnoDB: Waiting for the background threads to start160727 21:42:00 InnoDB: 5.5.50 started; log sequence number 1595675160727 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: 3306160727 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 endedView 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 | grep mysqldlinuxidc 453621460 21:43 pts/000:00:00 /bin/sh /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnflinuxidc 477345361 21:43 pts/000: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=3306linuxidc 479220970 21:44 pts/200:00:00 grep --color=auto mysqldView Code疑问:不知是Ubuntu指定了basedir=/usr/local/mysql,datadir=/usr/local/mysql/data;还是最开始的初始化没有管用,还是有什么配置没有写在配置文件中。当然是没有写在配置文件中了,可以查看一下my-medium.cnf内容 [client]#password = your_passwordport= 3306socket= /tmp/mysql.sock # Here follows entries for some specific programs # The MySQL server[mysqld]port= 3306socket= /tmp/mysql.sockskip-external-lockingkey_buffer_size = 16Mmax_allowed_packet = 1Mtable_open_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_size = 256Kread_rnd_buffer_size = 512Kmyisam_sort_buffer_size = 8M View Code没有相关目录的配置;增加启动配置参考:mysqld_safe — MySQL Server Startup Script在my.cnf 增加一下配置 my.cnfport= 3306socket= /tmp/mysqldata/node1/mysql.sock [mysqld_safe]user=linuxidc # Here follows entries for some specific programs # The MySQL server[mysqld]port= 3306socket= /tmp/mysqldata/node1/mysql.sockpid-file= /tmp/mysqldata/node1/mysqld.pidbasedir = /usr/local/mysql55datadir = /tmp/mysqldata/node1innodb_data_home_dir = /tmp/mysqldata/node1innodb_log_group_home_dir =/tmp/mysqldata/node1tmpdir= /tmp/mysqldata/node1log-error = /tmp/mysqldata/node1/linuxidc.loglog-bin = /tmp/mysqldata/node1/mysql-bin.logView 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 installationdirectory 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:46 InnoDB: The InnoDB memory heap is disabled160806 16:48:46 InnoDB: Mutexes and rw_locks use GCC atomic builtins160806 16:48:46 InnoDB: Compressed tables use zlib 1.2.3160806 16:48:46 InnoDB: Using Linux native AIO160806 16:48:46 InnoDB: Initializing buffer pool, size = 128.0MView Code解决:在配置文件中启用,nice=0#my.cnf增加nice=04)账号安全设置#删除空用户mysql -uroot --socket=/tmp/mysql.sockselect user,host,password from mysql.user;delete from mysql.user where user="";delete from mysql.user where host<>"localhost"; mysql> select user,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.sockgrant select on *.* to test@"localhost" identified by "123"; 使用test用户,在test库中建表#mysql -utest -p123 --socket=/tmp/mysql.sockuse testcreate 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
  1. 下载mysql5.6安装包并配置mysql5.6安装包安装路径
  2. 关闭mysql5.5的实例,修改部分参数,使用mysql5.6软件启动
  3. 执行mysql5.6路径下mysql_upgrade脚本
  4. 验证是否成功升级
MySQL升级1)关闭mysql查看mysql是否启动linuxidc@linuxidc:/tmp/mysqldata$ ps -ef | grep mysqldlinuxidc 493121460 22:32 pts/000:00:00 /bin/sh /usr/local/mysql55/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnflinuxidc 516849310 22:32 pts/000: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=3306linuxidc 518748890 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 -pEnter 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 | grep mysqldlinuxidc 491821460 22:28 pts/000:00:00 grep --color=auto mysqld2)更改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 | grep mysqllinuxidc 912185470 21:29 pts/200:00:00 /bin/sh /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnflinuxidc 948991210 21:29 pts/200: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=3306linuxidc 956485470 21:35 pts/200:00:00 grep --color=auto mysql#登陆后查看mysql状态mysql> status--------------mysqlVer 14.14 Distrib 5.6.32, for linux-glibc2.5 (x86_64) usingEditLine wrapper Connection id:3Current database: Current user:root@localhostSSL:Not in useCurrent pager:stdoutUsing outfile:""Using delimiter:;Server version:5.6.32-log MySQL Community Server (GPL)Protocol version:10Connection:Localhost via UNIX socketServer characterset:latin1Db characterset:latin1Client characterset:utf8Conn.characterset:utf8UNIX socket:/tmp/mysqldata/node1/mysql.sockUptime:7 min 27 sec Threads: 1Questions: 5Slow queries: 0Opens: 32Flush tables: 1Open tables: 25Queries per second avg: 0.011--------------4)升级库mysql_upgradelinuxidc@linuxidc:/tmp/mysqldata$ /usr/local/mysql56/bin/mysql_upgrade -uroot --socket=/tmp/mysqldata/node1/mysql.sock -pEnter password:Looking for "mysql" as: /usr/local/mysql56/bin/mysqlLooking for "mysqlcheck" as: /usr/local/mysql56/bin/mysqlcheckRunning "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 OKmysql.db OKmysql.eventOKmysql.func OKmysql.general_logOKmysql.help_categoryOKmysql.help_keyword OKmysql.help_relationOKmysql.help_topic OKmysql.host OKmysql.ndb_binlog_index OKmysql.plugin OKmysql.proc OKmysql.procs_priv OKmysql.proxies_priv OKmysql.serversOKmysql.slow_log OKmysql.tables_privOKmysql.time_zoneOKmysql.time_zone_leap_secondOKmysql.time_zone_name OKmysql.time_zone_transition OKmysql.time_zone_transition_typeOKmysql.user OKRunning "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.OKView Code#验证库有没有升级成功linuxidc@linuxidc:/tmp/mysqldata$ /usr/local/mysql56/bin/mysql_upgrade -uroot --socket=/tmp/mysqldata/node1/mysql.sock -pEnter password:Looking for "mysql" as: /usr/local/mysql56/bin/mysqlLooking for "mysqlcheck" as: /usr/local/mysql56/bin/mysqlcheckThis installation of MySQL is already upgraded to 5.6.32, use --force if you still need to run mysql_upgrademysql多实例安装
  1. 部署好mysql软件
  2. 编辑多个配置文件,初始化多个实例
  3. 启动mysql实例
为啥多实例部署?
  • 充分利用系统资源
  • 资源隔离
  • 业务,模块隔离
 多实例安装#mkdir -p /mysqldata/node3a) 初始化实例 使用脚本mysql_install_dblinuxidc@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 ../node3ibdata1ib_logfile0ib_logfile1mysqlperformance_schematestb) 给node3配置文件cp my2.cnf my3.cnfvim my3.cnf(修改相关参数)[client]#password = your_passwordport= 3308socket= /tmp/mysqldata/node3/mysql.sock [mysqld_safe]user=linuxidcledir = /usr/local/mysql56/bin#ledir = /usr/local/mysql55/binnice = 0# Here follows entries for some specific programs # The MySQL server[mysqld]port= 3308socket= /tmp/mysqldata/node3/mysql.sockpid-file= /tmp/mysqldata/node3/mysqld.pidbasedir = /usr/local/mysql56#basedir = /usr/local/mysql55datadir = /tmp/mysqldata/node3innodb_data_home_dir= /tmp/mysqldata/node3innodb_log_group_home_dir = /tmp/mysqldata/node3tmpdir= /tmp/mysqldata/node3log-error = /tmp/mysqldata/node3/linuxidc.loglog-bin = /tmp/mysqldata/node3/mysql-bin.logc) 使用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/node3d)查看 linuxidc@linuxidc:/tmp/mysqldata/node3$ ps -ef | grep mysqldlinuxidc 912185470 21:29 pts/200:00:00 /bin/sh /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/my.cnflinuxidc 948991210 21:29 pts/200: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=3306linuxidc 986185470 22:03 pts/200:00:00 /bin/sh /usr/local/mysql56/bin/mysqld_safe --defaults-file=/tmp/mysqldata/node3/my3.cnflinuxidc1032798610 22:03 pts/200: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=3308linuxidc1035085470 22:04 pts/200:00:00 grep --color=auto mysqld 可以看到有两个端口的mysqld,分别是3306,3308; e) 登陆新实例,删除test库,空用户,设置root密码 linuxidc@linuxidc:/tmp/mysqldata/node3$ mysql -uroot --socket=/tmp/mysqldata/node3/mysql.sockWelcome to the MySQL monitor.Commands end with ; or g.Your MySQL connection id 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 itsaffiliates. Other names may be trademarks of their respectiveowners. Type "help;" or "h" for help. Type "c" to clear the current input statement. delete from msyql.user where user="";delete from mysql.user where host<>"localhost";set password for root@"localhost"=password("000000");delete from mysql.db;drop database test;flush privileges; View Codemysql线上安装小结
  • 根据需求选择合适的版本以及分支,建议使用或升级到较高版本5.5或5.6
  • 如果需要定制mysql功能的话,可以考虑编译安装,否则的话建议使用二进制包安装,比较省事。
  • 根据机器配置选择部署多个mysql实例还是单个实例,机器配置非常好的话,建议部署多实例
本文永久更新链接地址