wfkjxy 发表于 2018-10-9 07:23:06

mysql 多实例安装

  #rm -f /etc/init.d/mysqld
  # mkdir -p /data/{3306,3307}/data
  # rpm -ivh tree-1.5.3-2.el6.x86_64.rpm

  warning: tree-1.5.3-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key>  Preparing...                ###########################################
  1:tree                   ###########################################
  # LANG=EN
  # tree /data
  /data
  |-- 3306
  |   `-- data
  `-- 3307
  `-- data
  # ls
  data      mysql-5.6.36         sendEmail-v1.56.tar.gz
  data.zipmysql-5.6.36.tar.gzzabbix-2.4.4.tar.gz
  # cp data/3306/my.cnf /data/3306/
  # cp data/3307/my.cnf /data/3307/
  # tree /data
  /data
  |-- 3306
  |   |-- data
  |   `-- my.cnf
  `-- 3307
  |-- data
  `-- my.cnf
  # cp data/3306/mysql /data/3306/
  # cp data/3307/mysql /data/3307/
  # tree /data
  /data
  |-- 3306
  |   |-- data
  |   |-- my.cnf
  |   `-- mysql
  `-- 3307
  |-- data
  |-- my.cnf
  `-- mysql
  # chown -R mysql.mysql /data
  # find /data/ -type f -name "mysql" |xargs ls -l
  -rw-r--r-- 1 mysql mysql 1307 Jun3 22:34 /data/3306/mysql
  -rw-r--r-- 1 mysql mysql 1307 Jun3 22:34 /data/3307/mysql
  # find /data/ -type f -name "mysql" |xargs chmod +x
  # find /data/ -type f -name "mysql" |xargs ls -l
  -rwxr-xr-x 1 mysql mysql 1307 Jun3 22:34 /data/3306/mysql
  -rwxr-xr-x 1 mysql mysql 1307 Jun3 22:34 /data/3307/mysql
  # cd /application/mysql/scripts/
  # ls
  mysql_install_dbmysqld
  # ./mysql_install_db --basedir=/application/mysql --datadir=/data/3306/data/ --user=mysql
  perl: warning: Setting locale failed.
  perl: warning: Please check that your locale settings:
  LANGUAGE = (unset),
  LC_ALL = (unset),
  LANG = "EN"
  are supported and installed on your system.
  ...................
  2017-06-03 22:45:23 19995 Binlog end
  2017-06-03 22:45:23 19995 InnoDB: FTS optimize thread exiting.
  2017-06-03 22:45:23 19995 InnoDB: Starting shutdown...
  2017-06-03 22:45:24 19995 InnoDB: Shutdown completed; log sequence number 1625987
  OK
  To start mysqld at boot time you have to copy
  .........................
  # ./mysql_install_db --basedir=/application/mysql --datadir=/data/3307/data/ --user=mysql
  perl: warning: Setting locale failed.
  perl: warning: Please check that your locale settings:
  LANGUAGE = (unset),
  LC_ALL = (unset),
  ...................
  # /data/3306/mysqlstart
  Starting MySQL...
  # 170603 22:51:40 mysqld_safe error: log-error set to '/data/3306/mysql_oldboy3306.err', however file don't exists. Create writable for user 'mysql'.
  # touch mysql_oldboy3306.err
  # ls
  datamy.cnfmysqlmysql_oldboy3306.err
  # ll
  total 12
  drwxr-xr-x 5 mysql mysql 4096 Jun3 22:45 data
  -rw-r--r-- 1 mysql mysql 1899 Jun3 22:29 my.cnf
  -rwxr-xr-x 1 mysql mysql 1307 Jun3 22:34 mysql
  -rw-r--r-- 1 rootroot   0 Jun3 22:52 mysql_oldboy3306.err
  # chown mysql:mysql mysql_oldboy3306.err
  # /data/3306/mysql start
  Starting MySQL...
  #netstat -lntup| grep 3306
  # netstat -lntup | grep 330
  tcp      0      0 :::3306                     :::*                        LISTEN      28142/mysqld
  tcp      0      0 :::3307                     :::*                        LISTEN      28866/mysqld
  报错:

  2017-06-03 22:56:18 24261 InnoDB: auto-extending data file ./ibdata1 is of a different>  2017-06-03 22:56:18 24261 InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
  解决:
  # cd data
  # pwd
  /data/3306/data
  # ls
  ibdata1ib_logfile0ib_logfile1mysqlperformance_schematest
  # rm -rf ib*
  报错:
  2017-06-03 23:33:27 26630 /application/mysql/bin/mysqld: unknown variable 'table_cache=614'
  2017-06-03 23:33:27 26630 Aborting
  解决:
  # vi my.cnf
  #table_cache = 614--注释掉

页: [1]
查看完整版本: mysql 多实例安装