반응형
TOC is not supported in this version (ex.Mobile)
The first thing you do after you build a database is create a database where that data is stored and create an account to access that database. I'll write about the establishment of the MariaDB database later.
First, access mariadb with root privileges. (Mariadb is based on mysql, so mysql has many similarities in commands.)
1. Connect to MariaDB
$> sudo mysql -u root
2. Create Database
create database {mydatabase};
3. Create Account
create user '{userName}’@'localhost' identified by '{userPassword}';
- For localhost, you can use % or a fixed IP instead of localhost when you access it from the outside only.
- Depending on the versionup, some MariaDBs are generally inaccessible because the password is encrypted if you use the above command. In this case, you must create and access it as follows.
4. Grant created DATABASE privileges to the USER
grant all privileges on {mydatabase}.* to ‘{userName}’@'localhost';
- For localhost, you can use % or a fixed IP instead of localhost if you are using it internally only.
5. Apply Setting
flush privileges;
In this article, {} is a random change, so you can change it to the name you want if necessary.
ex) When creating a database called product
create database product;
[MariaDB] How to create database and account
🇰🇷 Korean
2020.08.04 - [개발 창고/Database] - [MariaDB] Database 및 사용자 계정 생성
반응형
'개발 창고 > Database' 카테고리의 다른 글
[프로그래머스] 강원도에 위치한 생산공장 목록 출력하기 - MySQL (42) | 2024.04.01 |
---|---|
[프로그래머스] 경기도에 위치한 식품창고 목록 출력하기 - MySQL (31) | 2024.03.31 |
[프로그래머스] 나이 정보가 없는 회원 수 구하기 - MySQL (41) | 2024.03.30 |
[프로그래머스] 조건에 맞는 회원수 구하기 - MySQL (47) | 2024.03.29 |
[프로그래머스] 가장 비싼 상품 구하기 - MySQL (27) | 2024.03.28 |