Skip to content

Instantly share code, notes, and snippets.

@ihangoon
Created March 7, 2020 20:58
Show Gist options
  • Save ihangoon/c30c20f353d00edf415bc52e5b2a82b6 to your computer and use it in GitHub Desktop.
Save ihangoon/c30c20f353d00edf415bc52e5b2a82b6 to your computer and use it in GitHub Desktop.
Install MariaDB 10.4 on WSL(ubuntu 18.04)
# 하기 페이지를 참고하여 사용 중인 Linux 버전에 맞는 것을 설치한다.
# https://downloads.mariadb.org/mariadb/repositories/#distro=Ubuntu&distro_release=bionic--ubuntu_bionic&mirror=hosting90&version=10.4
# ubuntu 18.04에서의 설치는 다음과 같다.
sudo apt-get install software-properties-common
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://suro.ubaya.ac.id/mariadb/repo/10.4/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server
# 현재 WSL에서는 systemctl으로 서비스를 기동할 수 없다.
# https://whiumisc.tistory.com/98 참고하여 서비스를 기동하는데 성공하였다. 감사합니다!
sudo cp /usr/share/mysql/mysql.init /etc/init.d/mysql
sudo chmod 755 /etc/init.d/mysql
sudo service mysql start
* Starting MariaDB database server mysqld [ OK ] thinkit@DESKTOP-05CLKJS:/mnt/c/Users/think$ sudo service mysql status
* /usr/bin/mysqladmin Ver 9.1 Distrib 10.4.12-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Server version 10.4.12-MariaDB-1:10.4.12+maria~bionic-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/run/mysqld/mysqld.sock
Uptime: 14 sec
Threads: 8 Questions: 444 Slow queries: 0 Opens: 170 Flush tables: 1 Open tables: 30 Queries per second avg: 31.714
# 서비스 실행에 성공하였으나, 로그인이 되지 않는다.
mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
# 다음 명령을 실행하여 root 패스워드 등을 설정한다.
sudo mysql_secure_installation
# 위에서 설정한 root 패스워드로 로그인한다.
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 62
Server version: 10.4.12-MariaDB-1:10.4.12+maria~bionic-log mariadb.org binary distribution
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 |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment