본문 바로가기

리눅스

[리눅스] mysql install on centos 7

728x90

mysql install on centos 7

mysql community 버전 다운로드 링크

https://dev.mysql.com/downloads/mysql/

https://dev.mysql.com/downloads/repo/yum/

mysql community 저장소(community-release) 다운로드 및 설치

wget https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
yum install mysql80-community-release-el7-7.noarch.rpm

mysql 저장소 목록

yum repolist enabled | grep mysql
$ yum repolist enabled | grep mysql
mysql-connectors-community/x86_64                     MySQL Connectors Co    206
mysql-tools-community/x86_64                          MySQL Tools Communi     94
mysql80-community/x86_64                              MySQL 8.0 Community    367
yum search mysql-community
$ yum search mysql-community
...
==================== N/S matched: mysql-community ====================
mysql-community-client.i686 : MySQL database client applications and tools
mysql-community-client.x86_64 : MySQL database client applications and tools
mysql-community-client-plugins.i686 : Shared plugins for MySQL client applications
mysql-community-client-plugins.x86_64 : Shared plugins for MySQL client applications
mysql-community-common.i686 : MySQL database common files for server and client libs
mysql-community-common.x86_64 : MySQL database common files for server and client libs
mysql-community-devel.i686 : Development header files and libraries for MySQL database client applications
mysql-community-devel.x86_64 : Development header files and libraries for MySQL database client applications
mysql-community-embedded-compat.i686 : MySQL embedded compat library
mysql-community-embedded-compat.x86_64 : MySQL embedded compat library
mysql-community-icu-data-files.i686 : MySQL packaging of ICU data files
mysql-community-icu-data-files.x86_64 : MySQL packaging of ICU data files
mysql-community-libs.i686 : Shared libraries for MySQL database client applications
mysql-community-libs.x86_64 : Shared libraries for MySQL database client applications
mysql-community-libs-compat.i686 : Shared compat libraries for MySQL 5.6.37 database client applications
mysql-community-libs-compat.x86_64 : Shared compat libraries for MySQL 5.6.51 database client applications
mysql-community-release.noarch : MySQL repository configuration for yum
mysql-community-server.x86_64 : A very fast and reliable SQL database server
mysql-community-server-debug.x86_64 : The debug version of MySQL server
mysql-community-test.x86_64 : Test suite for the MySQL database server

mysql server(mysqld) 설치

yum install -y mysql-community-server

mysql server(mysqld) 버전 정보 확인

mysqld -V
$ mysqld -V
/usr/sbin/mysqld  Ver 8.0.31 for Linux on x86_64 (MySQL Community Server - GPL)

mysql server(mysqld) 시작

systemctl --now enable mysqld
systemctl status mysqld
$ systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 화 2022-11-29 13:19:24 KST; 17s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 23448 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 23676 (mysqld)
   Status: "Server is operational"
    Tasks: 39
   Memory: 442.9M
   CGroup: /system.slice/mysqld.service
           └─23676 /usr/sbin/mysqld

11월 29 13:18:50 serv-24 systemd[1]: Starting MySQL Server...
11월 29 13:19:24 serv-24 systemd[1]: Started MySQL Server.

mysql server(mysqld.log) 로그 확인

- mysql server root 패스워드 확인

  [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: i&lSAsQtu2Pq

$ cat /var/log/mysqld.log 
2022-11-29T04:18:52.510268Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 23481
2022-11-29T04:18:52.563802Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-11-29T04:18:56.385512Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-11-29T04:19:04.608254Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: i&lSAsQtu2Pq
2022-11-29T04:19:23.480197Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 23676
2022-11-29T04:19:23.503277Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-11-29T04:19:23.947482Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-11-29T04:19:24.663295Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-11-29T04:19:24.663381Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-11-29T04:19:24.720662Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-11-29T04:19:24.720686Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.
$ cat /var/log/mysqld.log | egrep "A temporary password is generated"
2022-11-29T04:19:04.608254Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: i&lSAsQtu2Pq

초기 패스워드로 접속

mysql -uroot -p'i&lSAsQtu2Pq'
$ mysql -uroot -p'i&lSAsQtu2Pq'
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 8
Server version: 8.0.31

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' for help. Type '\c' to clear the current input statement.

mysql>

mysql root 패스워드 변경

ALTER USER 'root'@'localhost' IDENTIFIED BY 'rootPassword1!';
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'rootPassword1!';
Query OK, 0 rows affected (0.05 sec)

 

728x90