리눅스마스터1급 : MySQL(MariaDB) MySQL운영
작성자 정보
- 관리자 작성
- 작성일
컨텐츠 정보
- 2,509 조회
- 0 추천
- 목록
본문
리눅스마스터1급 : MySQL(MariaDB) MySQL운영
MySQL의 시작과 종료, 확인등은 MySQL에서 제공하는 스크립트(mysql.server)를 이용하면 된다.
이 스크립트는 리눅스의 서비스로 등록하면 서버부팅시 자동으로 시작되게 할 수 있고 편리하게 관리 할 수 있다.
|
|
|
| [root@SULinux-64Bit mysql]# ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld [root@SULinux-64Bit mysql]# chkconfig --add mysqld [root@SULinux-64Bit mysql]# chkconfig mysqld on |
|
|
|
|
표준 서비스 명령어로 MySQL 시작한다.
|
|
|
| [root@SULinux-64Bit mysql]# service mysqld start Starting MySQL. [ OK ] |
|
|
|
|
[root@RockyLinux01 ~]# systemctl start mariadb [root@RockyLinux01 ~]# [root@RockyLinux01 ~]# ps -ef | grep mariadb mysql 2034 1 0 09:55 ? 00:00:00 /usr/libexec/mariadbd --basedir=/usr root 2814 1778 0 11:19 pts/0 00:00:00 grep --color=auto mariadb [root@RockyLinux01 ~]# |
MySQL 동작 확인
|
|
|
| [root@SULinux-64Bit mysql]# service mysqld status MySQL running (14636) [ OK ] |
|
|
|
|
[root@RockyLinux01 ~]# systemctl status mariadb ● mariadb.service - MariaDB 10.5 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: active (running) since Fri 2023-06-16 09:55:19 KST; 1h 24min ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Process: 1977 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS) Process: 1999 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS) Process: 2046 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS) Main PID: 2034 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 8 (limit: 12195) Memory: 110.8M CPU: 729ms CGroup: /system.slice/mariadb.service └─2034 /usr/libexec/mariadbd --basedir=/usr
6월 16 09:55:19 RockyLinux01 systemd[1]: Starting MariaDB 10.5 database server... 6월 16 09:55:19 RockyLinux01 mariadb-prepare-db-dir[1999]: Database MariaDB is probably initialized in /var/lib/mysql > 6월 16 09:55:19 RockyLinux01 mariadb-prepare-db-dir[1999]: If this is not the case, make sure the /var/lib/mysql is em> 6월 16 09:55:19 RockyLinux01 mariadbd[2034]: 2023-06-16 9:55:19 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.16-MariaD> 6월 16 09:55:19 RockyLinux01 systemd[1]: Started MariaDB 10.5 database server. [root@RockyLinux01 ~]# |
MySQL 정지
|
|
|
| [root@SULinux-64Bit mysql]# service mysqld stop Shutting down MySQL.. [ OK ] |
|
|
|
|
[root@RockyLinux01 ~]# systemctl stop mariadb [root@RockyLinux01 ~]# [root@RockyLinux01 ~]# ps -ef | grep mariadb root 2827 1778 0 11:20 pts/0 00:00:00 grep --color=auto mariadb [root@RockyLinux01 ~]# |
mysqladmin 명령어로 mysql root 비밀번호를 생성한다.
[root@RockyLinux01 ~]# mysqladmin password 11111111 [root@RockyLinux01 ~]# |
mysql 명령어로 MySQL 서버에 접속한다.
|
|
|
| [root@RockyLinux01 ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 10.5.16-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> MariaDB [(none)]> |
|
|
|
|
관련자료
-
이전
-
다음