--mariadb server
[root@realserver-02 ~]# dnf -y install mariadb*
--cli 원복
systemctl set-default graphical.target
-- version 확인
[root@realserver-02 ~]# mysql -v
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.22-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit
Writing history-file /root/.mysql_history
Bye
--한글화
[root@realserver-02 ~]# cd /etc/my.cnf.d
[root@realserver-02 my.cnf.d]# ls
auth_gssapi.cnf enable_encryption.preset mariadb-server.cnf oqgraph.cnf
client.cnf galera.cnf mysql-clients.cnf spider.cnf
[root@realserver-02 my.cnf.d]# vi ./mariadb-server.cnf
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mariadb/mariadb.log
pid-file=/run/mariadb/mariadb.pid
-아래에 추가
init_connect="SET collation_connection=utf8_general_ci"
init_connect="SET NAMES utf8"
character-set-server=utf8
collation-server=utf8_general_ci
--mariadb 재시작
[root@realserver-02 my.cnf.d]# systemctl restart mariadb.service
--mariadb port number 확인
[root@realserver-02 my.cnf.d]# netstat -antup | grep maria
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 7014/mariadbd
--status
[root@realserver-02 my.cnf.d]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.22-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)]> status
--------------
~~
Server characterset: utf8 --utf8인거 확인
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
~~
--------------
MariaDB [(none)]> exit
Bye
--DBMS 관리자 암호 설정
[root@realserver-02 my.cnf.d]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
host에서 winscp를 사용하여 가져온 sql을 mariadb database에 추가
--sql 확인
[root@realserver-02 ~]# ls
anaconda-ks.cfg webtest_DB.sql 공개 다운로드 문서 바탕화면 비디오 사진 서식 음악
--sql 형식 확인
[root@realserver-02 ~]# file webtest_DB.sql
webtest_DB.sql: ASCII text
--database 불러오기
[root@realserver-02 ~]# mysql -u root -pP@ssw0rd < /root/webtest_DB.sql
[root@realserver-02 ~]# mysql -u root -pP@ssw0rd
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.5.22-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)]> show databases;
+--------------------+
| Database |
+--------------------+
| WebTest |
| information_schema |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.001 sec)
MariaDB [(none)]> use WebTest
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [WebTest]> show tables;
+-------------------+
| Tables_in_WebTest |
+-------------------+
| board |
| member |
+-------------------+
2 rows in set (0.000 sec)
MariaDB [WebTest]>
'IaC Application > 3tier-service' 카테고리의 다른 글
2tier - service (0) | 2024.03.25 |
---|---|
1tier-service (0) | 2024.03.25 |