运维联盟俱乐部

 找回密码
 立即注册
查看: 2122|回复: 0

[安装部署] mysql 8.0之tar包安装

[复制链接]
  • TA的每日心情
    开心
    2023-8-9 11:05
  • 发表于 2021-12-14 15:35:36 | 显示全部楼层 |阅读模式
    1.
    1. [root@vm1 tmp]# mkdir -p /usr/local/mysql
    2. [root@vm1 tmp]# tar -zxf mysql-8.0.27-el7-x86_64.tar.gz -C /usr/local/mysql
    3. [root@vm1 tmp]# useradd -s /sbin/nologin mysql -M
    4. [root@vm1 tmp]# id mysql
    5. uid=1008(mysql) gid=1010(mysql) groups=1010(mysql)
    6. [root@vm1 tmp]# chown -R mysql.mysql /usr/local/mysql
    复制代码
    2.
    1. [root@vm1 tmp]# chown -R mysql.mysql /usr/local/mysql
    2. [root@vm1 tmp]# mkdir -p /app/mysql/data
    3. [root@vm1 tmp]# chown -R mysql.mysql /app/mysql/data
    4. [root@vm1 tmp]# chmod -R 775 /app/mysql/data
    复制代码
    3.
    1. cat>>/etc/my.cnf<<EOF
    2. [mysql]
    3. default-character-set=utf8
    4. [mysqld]
    5. skip-name-resolve
    6. port = 3306
    7. basedir=/usr/local/mysql
    8. datadir=/app/mysql/data
    9. max_connections=200
    10. character-set-server=utf8
    11. lower_case_table_names=1
    12. default-storage-engine=INNODB
    13. EOF
    复制代码
    4.
    1. [root@vm1 bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/app/mysql/data --lower_case_table_names=1
    2. 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
    3. 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.
    4. 2021-12-14T07:19:28.883884Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    5. 2021-12-14T07:19:29.282255Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    6. 2021-12-14T07:19:29.942547Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
    7. 2021-12-14T07:19:29.942563Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
    8. 2021-12-14T07:19:30.020863Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7o=f9N/0UUn>
    复制代码
    5.
    1. [root@vm1 support-files]# ./mysql.server start
    2. Starting MySQL. SUCCESS!
    3. [root@vm1 support-files]# ps -ef | grep mysqld
    4. 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
    5. 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.
    1. [root@vm1 support-files]#  ln -s /usr/local/mysql/bin/mysql /usr/bin
    2. [root@vm1 support-files]# mysql -uroot -p
    3. Enter password:
    4. Welcome to the MySQL monitor.  Commands end with ; or \g.
    5. Your MySQL connection id is 8
    6. Server version: 8.0.27

    7. Copyright (c) 2000, 2021, Oracle and/or its affiliates.

    8. Oracle is a registered trademark of Oracle Corporation and/or its
    9. affiliates. Other names may be trademarks of their respective
    10. owners.

    11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    12. mysql>
    复制代码
    7.
    1. mysql> show databases;
    2. ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
    3. mysql> show user;
    4. 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
    5. mysql> alter user 'root'@'localhost' identified by '123456';
    6. Query OK, 0 rows affected (0.02 sec)
    复制代码



    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    运维联盟俱乐部 ( 冀ICP备19036648号 )

    GMT+8, 2024-4-29 06:56 , Processed in 0.051333 second(s), 22 queries , Gzip On.

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表