sudo apt-get install mariadb-server

 

sudo mysql_secure_installation

 

Set root password? [Y/n] Y 

Remove anonymous users? [Y/n] Y

Disallow root login remotely? [Y/n] n

Remove test database and access to it? [Y/n] Y

Reload privilege tables now? [Y/n] y

 

 

셋팅완료후 접속을 하면..

root@peta:/home/peta# mysql -u -root -p
Enter password: 
ERROR 1698 (28000): Access denied for user '-root'@'localhost'

 

접속이 되질 않는다..

 

설정을 바꾸어주자.

root@peta:/home/peta# mysql

MariaDB [(none)]> use mysql;

MariaDB [mysql]> update user set plugin='' where user='root';

MariaDB [mysql]> flush privileges;

 

 

이제 데이터베이스와 계정을 생성하자.

 

MariaDB [(none)]> create database testDB;

MariaDB [(none)]> create user 'testId'@'%' identified by 'Passwd';

MariaDB [mysql]> grant all privileges on testDB.* to 'testId'@'%';

MariaDB [mysql]> flush privileges;

 

 

root@peta:/home/peta# vi /etc/mysql/mariadb.conf.d/50-server.cnf 
#문자열 변경
collation-server      = utf8mb4_unicode_ci

#외부접속허용
bind-address            = 0.0.0.0

 

이렇게 모든셋팅이 완료되었다.

+ Recent posts