admin 发表于 2021-12-14 15:35:36

mysql 8.0之tar包安装

1.
# mkdir -p /usr/local/mysql
# tar -zxf mysql-8.0.27-el7-x86_64.tar.gz -C /usr/local/mysql
# useradd -s /sbin/nologin mysql -M
# id mysql
uid=1008(mysql) gid=1010(mysql) groups=1010(mysql)
# chown -R mysql.mysql /usr/local/mysql
2.
# chown -R mysql.mysql /usr/local/mysql
# mkdir -p /app/mysql/data
# chown -R mysql.mysql /app/mysql/data
# chmod -R 775 /app/mysql/data3.
cat>>/etc/my.cnf<<EOF

default-character-set=utf8

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.
# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/app/mysql/data --lower_case_table_names=1
2021-12-14T07:19:28.866759Z 0 /usr/local/mysql/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 2206
2021-12-14T07:19:28.867599Z 0 --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 InnoDB initialization has started.
2021-12-14T07:19:29.282255Z 1 InnoDB initialization has ended.
2021-12-14T07:19:29.942547Z 0 A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-12-14T07:19:29.942563Z 0 A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-12-14T07:19:30.020863Z 6 A temporary password is generated for root@localhost: 7o=f9N/0UUn>
5.
# ./mysql.server start
Starting MySQL. SUCCESS!
# ps -ef | grep mysqld
root      2997   10 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   318629970 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.
#ln -s /usr/local/mysql/bin/mysql /usr/bin
# 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)



页: [1]
查看完整版本: mysql 8.0之tar包安装