mysql 多实例安装
admin
2023-05-18 14:02:18
0

[root@mysqlserver ~]#rm -f /etc/init.d/mysqld

[root@mysqlserver ~]# mkdir -p /data/{3306,3307}/data

[root@mysqlserver Packages]# 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 ID c105b9de: NOKEY

Preparing...                ########################################### [100%]

   1:tree                   ########################################### [100%]


[root@mysqlserver Packages]# LANG=EN

[root@mysqlserver Packages]# tree /data

/data

|-- 3306

|   `-- data

`-- 3307

    `-- data


[root@mysqlserver tools]# ls

data      mysql-5.6.36         sendEmail-v1.56.tar.gz

data.zip  mysql-5.6.36.tar.gz  zabbix-2.4.4.tar.gz

[root@mysqlserver tools]# cp data/3306/my.cnf /data/3306/

[root@mysqlserver tools]# cp data/3307/my.cnf /data/3307/

[root@mysqlserver tools]# tree /data

/data

|-- 3306

|   |-- data

|   `-- my.cnf

`-- 3307

    |-- data

    `-- my.cnf

[root@mysqlserver tools]# cp data/3306/mysql /data/3306/

[root@mysqlserver tools]# cp data/3307/mysql /data/3307/

[root@mysqlserver tools]# tree /data

/data

|-- 3306

|   |-- data

|   |-- my.cnf

|   `-- mysql

`-- 3307

    |-- data

    |-- my.cnf

    `-- mysql

[root@mysqlserver tools]# chown -R mysql.mysql /data


[root@mysqlserver tools]# find /data/ -type f -name "mysql" |xargs ls -l

-rw-r--r-- 1 mysql mysql 1307 Jun  3 22:34 /data/3306/mysql

-rw-r--r-- 1 mysql mysql 1307 Jun  3 22:34 /data/3307/mysql

[root@mysqlserver tools]# find /data/ -type f -name "mysql" |xargs chmod +x

[root@mysqlserver tools]# find /data/ -type f -name "mysql" |xargs ls -l

-rwxr-xr-x 1 mysql mysql 1307 Jun  3 22:34 /data/3306/mysql

-rwxr-xr-x 1 mysql mysql 1307 Jun  3 22:34 /data/3307/mysql


[root@mysqlserver tools]# cd /application/mysql/scripts/

[root@mysqlserver scripts]# ls

mysql_install_db  mysqld

[root@mysqlserver scripts]# ./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 [Note] Binlog end

2017-06-03 22:45:23 19995 [Note] InnoDB: FTS optimize thread exiting.

2017-06-03 22:45:23 19995 [Note] InnoDB: Starting shutdown...

2017-06-03 22:45:24 19995 [Note] InnoDB: Shutdown completed; log sequence number 1625987

OK


To start mysqld at boot time you have to copy

.........................



[root@mysqlserver scripts]# ./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),

...................


[root@mysqlserver tools]# /data/3306/mysql  start

Starting MySQL...

[root@mysqlserver tools]# 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'.

[root@mysqlserver 3306]# touch mysql_oldboy3306.err

[root@mysqlserver 3306]# ls

data  my.cnf  mysql  mysql_oldboy3306.err

[root@mysqlserver 3306]# ll

total 12

drwxr-xr-x 5 mysql mysql 4096 Jun  3 22:45 data

-rw-r--r-- 1 mysql mysql 1899 Jun  3 22:29 my.cnf

-rwxr-xr-x 1 mysql mysql 1307 Jun  3 22:34 mysql

-rw-r--r-- 1 root  root     0 Jun  3 22:52 mysql_oldboy3306.err

[root@mysqlserver 3306]# chown mysql:mysql mysql_oldboy3306.err

[root@mysqlserver 3306]# /data/3306/mysql start

Starting MySQL...


[root@mysqlserver 3306]#netstat -lntup| grep 3306

[root@mysqlserver 3307]# netstat -lntup | grep 330[6-7]

tcp        0      0 :::3306                     :::*                        LISTEN      28142/mysqld

tcp        0      0 :::3307                     :::*                        LISTEN      28866/mysqld



报错:

2017-06-03 22:56:18 24261 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 8192 pages, max 0 (relevant if non-zero) pages!

2017-06-03 22:56:18 24261 [ERROR] 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!

解决:

[root@mysqlserver 3306]# cd data

[root@mysqlserver data]# pwd

/data/3306/data

[root@mysqlserver data]# ls

ibdata1  ib_logfile0  ib_logfile1  mysql  performance_schema  test

[root@mysqlserver data]# rm -rf ib*



报错:

2017-06-03 23:33:27 26630 [ERROR] /application/mysql/bin/mysqld: unknown variable 'table_cache=614'

2017-06-03 23:33:27 26630 [ERROR] Aborting

解决:

[root@mysqlserver 3306]# vi my.cnf

#table_cache = 614  --注释掉



相关内容

热门资讯

浙江宣传评文艺圈“塌房”:人品... 近几年来,文艺圈人品“塌房”事件屡有发生,从言行失范、私德有亏到违法犯罪,当创作者的德行有了污点,其...
伊朗看到了美国的3个软肋 全世界现在哭笑不得。刚扬言要狠狠打击伊朗,打击伊朗的能源基础设施,甚至感觉迫在眉睫、必须要打、不打不...
接连反转!特朗普透露三个信息 特朗普称美伊3日将举行谈判。美国总统特朗普当地时间8月2日,美国总统特朗普谈及伊朗时称,关于霍尔木兹...
河南深夜通报:查实作弊 针对近期备受关注的2026年河南省“三支一扶”计划招募相关舆情,河南省“三支一扶”领导小组协调办公室...
高通机器人演示翻车,DeepM... 人形机器人领域正呈现出截然不同的两面性。一端是高通(Qualcomm)机器人的尴尬演示:在展示搭载最...
小米多款主力手机涨价,店员:很... 8月2日,小米商城显示,多款手机主力机型价格上调300元至500元不等。其中,REDMI Turbo...
主持人陈璇采访《奥德赛》主创人... 诺兰新片《奥德赛》周四举行北京首映礼,上海外语频道主持人陈璇采访外籍主创人员时半蹲弯腰,背对镜头,向...
初创公司推Arm架构AI服务器... 由前谷歌和Meta工程师于2023年创立的Majestic Labs,近日发布了一款旨在挑战英伟达G...
日元跌跌不休,美国罕见出手,外... 【环球时报驻日本特约记者 王军】在日元跌至近40年来最低水平后,日本政府和日本银行连续出手干预汇市,...
特朗普再提珍珠港事件 据朝日电视台8月3日报道,美国总统特朗普表示,美国政府出手买入日元实施汇率干预,目的是帮扶日本。2日...