//创建各实例数据存放目录 [root@mysql local]# mkdir -p /opt/data/{3306,3307,3308} [root@mysql local]# chown -R mysql.mysql /opt/data/ [root@mysql local]# ll /opt/data/ total 0 drwxr-xr-x. 2 mysql mysql 6 Aug 323:103306 drwxr-xr-x. 2 mysql mysql 6 Aug 323:103307 drwxr-xr-x. 2 mysql mysql 6 Aug 323:103308
5、初始化各实例
初始化3306
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@mysql ~]# mysqld --initialize --datadir=/opt/data/3306 --user=mysql 2024-08-03T15:59:39.140768Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-03T15:59:39.290523Z 0 [Warning] InnoDB: New log files created, LSN=45790 2024-08-03T15:59:39.311891Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2024-08-03T15:59:39.367520Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6396fb3d-51b1-11ef-9f29-000c29d1dcca. 2024-08-03T15:59:39.368159Z 0 [Warning] Gtid table isnot ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2024-08-03T15:59:40.097249Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2or higher. 2024-08-03T15:59:40.097414Z 0 [Warning] A deprecated TLS version TLSv1.1is enabled. Please use TLSv1.2or higher. 2024-08-03T15:59:40.104003Z 0 [Warning] CA certificate ca.pem is self signed. 2024-08-03T15:59:40.249269Z 1 [Note] A temporary password is generated for root@localhost: u-Xpj-e0(&Er
[root@mysql ~]# mysqld --initialize --datadir=/opt/data/3307 --user=mysql 2024-08-03T16:05:34.713724Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-03T16:05:34.852024Z 0 [Warning] InnoDB: New log files created, LSN=45790 2024-08-03T16:05:34.874848Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2024-08-03T16:05:34.928396Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3785442e-51b2-11ef-a8da-000c29d1dcca. 2024-08-03T16:05:34.929066Z 0 [Warning] Gtid table isnot ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2024-08-03T16:05:35.221373Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2or higher. 2024-08-03T16:05:35.221570Z 0 [Warning] A deprecated TLS version TLSv1.1is enabled. Please use TLSv1.2or higher. 2024-08-03T16:05:35.221942Z 0 [Warning] CA certificate ca.pem is self signed. 2024-08-03T16:05:35.404217Z 1 [Note] A temporary password is generated for root@localhost: jgpdj=3_R69w [root@mysql ~]# echo "jgpdj=3_R69w" > 3307_pass [root@mysql ~]# cat 3307_pass jgpdj=3_R69w
初始化3308
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@mysql ~]# mysqld --initialize --datadir=/opt/data/3308 --user=mysql 2024-08-03T16:06:28.371318Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-03T16:06:28.791900Z 0 [Warning] InnoDB: New log files created, LSN=45790 2024-08-03T16:06:28.855382Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2024-08-03T16:06:28.909741Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 57b22a61-51b2-11ef-abbf-000c29d1dcca. 2024-08-03T16:06:28.910440Z 0 [Warning] Gtid table isnot ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2024-08-03T16:06:29.239286Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2or higher. 2024-08-03T16:06:29.239450Z 0 [Warning] A deprecated TLS version TLSv1.1is enabled. Please use TLSv1.2or higher. 2024-08-03T16:06:29.239839Z 0 [Warning] CA certificate ca.pem is self signed. 2024-08-03T16:06:29.391293Z 1 [Note] A temporary password is generated for root@localhost: pu>DiHCY>0NS [root@mysql ~]# echo "pu>DiHCY>0NS" > 3308_pass [root@mysql ~]# cat 3308_pass pu>DiHCY>0NS
[root@mysql ~]# mysql -uroot -p`u-Xpj-e0(&Er` -S /tmp/mysql3306.sock -bash: command substitution: line 1: syntax error near unexpected token `&' -bash: command substitution: line 1: `u-Xpj-e0(&Er' Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection idis3 Server version: 5.7.37
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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'forhelp. Type'\c' to clear the current input statement.
[root@mysql ~]# cat 3307_pass jgpdj=3_R69w [root@mysql ~]# mysql -uroot -p'jgpdj=3_R69w' -S /tmp/mysql3307.sock mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection idis2 Server version: 5.7.37
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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'forhelp. Type'\c' to clear the current input statement.
[root@mysql ~]# cat 3308_pass pu>DiHCY>0NS [root@mysql ~]# mysql -uroot -p'pu>DiHCY>0NS' -S /tmp/mysql3308.sock mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection idis2 Server version: 5.7.37
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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'forhelp. Type'\c' to clear the current input statement.