StoryCode

Install mariadb.10.6.tar.gz in ubuntu

Database 관리/Maria DB
반응형

# 참조 : https://dbwriter.io/installation-mariadb10/

 

1) 다운로드

https://downloads.mariadb.org/

 

2) 압축해제 및 mysql 사용자 추가

sudo groupadd mysql
sudo useradd -g mysql mysql
cd /usr/local
sudo tar -zxvpf mariadb-10.6.4-linux-systemd-x86_64.tar.gz
sudo ln -s mariadb-10.6.4-linux-systemd-x86_64 mysql

 

3) vi /etc/my.cnf

[client-server]
port=3306

# This will be passed to all MariaDB clients
[client]

# The MariaDB server
[mysqld]
# Directory where you want to put your data
datadir=/usr/local/mysql/data

 

character-set-server = utf8mb4
init_connect = SET collation_connection = utf8mb4_general_ci
init_connect = SET NAMES utf8mb4


# This is the prefix name to be used for all log, error and replication files
log-basename=mariadb

 

 

 

4) 초기화

cd /usr/local/mysql
sudo ./scripts/mysql_install_db --user=mysql

 

 

5) 디렉토리 권한 변경

/usr/local/mysql> sudo chown -R root .
/usr/local/mysql> sudo chown -R mysql data

 

6) 서버 기동

sudo ./bin/mysqld_safe --user=mysql &
or
sudo ./bin/mysqld_safe --defaults-file=~/.my.cnf --user=mysql &

 

7) 오류발생시

# ERROR 2002 (HY000): Can't connect to local server through socket '/var/run/mysqld/mysqld.sock' (2)

sudo mkdir /var/run/mysqld

sudo ln - /tmp/mysql.sock /var/run/mysqld/mysqld.sock

 

8)

> mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.6.4-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)]> select user();

+------------------+
| user()           |
+------------------+
| user@localhost |
+------------------+

 

9)  sudo ./mysql_secure_installation

Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] Y
New password: "ROOT 비번 설정"
Re-enter new password:
Password updated successfully!
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] n
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!

 

10)

mysql> select host, user from mysql.user;

mysql> create user ml@localhost identified by 'ml';

mysql> flush privileges;

mysql> grant all privileges on *.* to ml@'localhost' identified by 'ml';

mysql> grant all privileges on *.* to ml@'%' identified by 'ml';
mysql> flush privileges;

 

11)

show variables like '%set%';

SELECT schema_name, default_character_set_name, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA ;

반응형

'Database 관리 > Maria DB' 카테고리의 다른 글

Data Directory 변경  (0) 2023.05.26
binlog 삭제  (0) 2023.01.16
Lock, 락, 해결  (0) 2021.10.29
RDS, export, mysqldump/ import  (0) 2021.10.14
[편법] CVS Parsing, 파싱  (0) 2021.09.23