TA的每日心情 | 开心 2023-8-9 11:05 |
---|
|
1.
- [root@vm1 tmp]# mkdir -p /usr/local/mysql
- [root@vm1 tmp]# tar -zxf mysql-8.0.27-el7-x86_64.tar.gz -C /usr/local/mysql
- [root@vm1 tmp]# useradd -s /sbin/nologin mysql -M
- [root@vm1 tmp]# id mysql
- uid=1008(mysql) gid=1010(mysql) groups=1010(mysql)
- [root@vm1 tmp]# chown -R mysql.mysql /usr/local/mysql
复制代码 2.
- [root@vm1 tmp]# chown -R mysql.mysql /usr/local/mysql
- [root@vm1 tmp]# mkdir -p /app/mysql/data
- [root@vm1 tmp]# chown -R mysql.mysql /app/mysql/data
- [root@vm1 tmp]# chmod -R 775 /app/mysql/data
复制代码 3.
- cat>>/etc/my.cnf<<EOF
- [mysql]
- default-character-set=utf8
- [mysqld]
- skip-name-resolve
- port = 3306
- basedir=/usr/local/mysql
- datadir=/app/mysql/data
- max_connections=200
- character-set-server=utf8
- lower_case_table_names=1
- default-storage-engine=INNODB
- EOF
复制代码 4.
- [root@vm1 bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/app/mysql/data --lower_case_table_names=1
- 2021-12-14T07:19:28.866759Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 2206
- 2021-12-14T07:19:28.867599Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
- 2021-12-14T07:19:28.883884Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
- 2021-12-14T07:19:29.282255Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
- 2021-12-14T07:19:29.942547Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
- 2021-12-14T07:19:29.942563Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
- 2021-12-14T07:19:30.020863Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7o=f9N/0UUn>
复制代码 5.
- [root@vm1 support-files]# ./mysql.server start
- Starting MySQL. SUCCESS!
- [root@vm1 support-files]# ps -ef | grep mysqld
- root 2997 1 0 15:25 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/app/mysql/data --pid-file=/app/mysql/data/vm1.pid
- mysql 3186 2997 0 15:25 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/app/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=vm1.err --pid-file=/app/mysql/data/vm1.pid --port=3306
复制代码 6.
- [root@vm1 support-files]# ln -s /usr/local/mysql/bin/mysql /usr/bin
- [root@vm1 support-files]# mysql -uroot -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 8
- Server version: 8.0.27
- Copyright (c) 2000, 2021, 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' for help. Type '\c' to clear the current input statement.
- mysql>
复制代码 7.
- mysql> show databases;
- ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
- mysql> show user;
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user' at line 1
- mysql> alter user 'root'@'localhost' identified by '123456';
- Query OK, 0 rows affected (0.02 sec)
复制代码
|
|