2 创建mysql用户和组 [root@rac1 bin]# groupadd mysql [root@rac1 bin]# useradd -g mysql mysql [root@rac1 bin]# id mysql uid=493(mysql) gid=5006(mysql) groups=5006(mysql) [root@rac1 bin]# passwd mysql
三:安装 1 解压 [root@rac1 mysql]# cd /package/mysql/ [root@rac1 mysql]# ll -rth total 641M -rw-r--r-- 1 root root 641M Jun 4 10:22 mysql-5.7.21-linux-glibc2.12-x86_64.tar
[root@rac1 mysql]# tar -xvf mysql-5.7.21-linux-glibc2.12-x86_64.tar mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz mysql-test-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@rac1 mysql]# ll -rth total 1.3G -rw-r--r-- 1 7161 31415 28M Dec 28 12:18 mysql-test-5.7.21-linux-glibc2.12-x86_64.tar.gz -rw-r--r-- 1 7161 31415 613M Dec 28 12:20 mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -rw-r--r-- 1 root root 641M Jun 4 10:22 mysql-5.7.21-linux-glibc2.12-x86_64.tar
[root@rac1 mysql]# tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@rac1 mysql]# du -sh mysql-5.7.21-linux-glibc2.12-x86_64 2.5G mysql-5.7.21-linux-glibc2.12-x86_64
6 登录mysql并修改密码 [mysql@rac1 data]$ pwd /usr/local/mysql/data [mysql@rac1 data]$ vi error.log 2018-06-04T03:51:14.789564Z 1 [Note] A temporary password is generated for root@localhost: k7deH1nLvo_N
[mysql@rac1 bin]$ ./mysql -uroot -p'k7deH1nLvo_N' 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 id is 6 Server version: 5.7.21
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
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> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by '123'; Query OK, 0 rows affected (0.10 sec)
[mysql@rac1 bin]$ ./mysql -uroot -p123 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 id is 9 Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.19 sec)