1. mysql 설치
> sudo apt update
> sudo apt install mysql-server
2. mysql 설정하기
> sudo mysql_secure_installation
Securing the MySQL server deployment. Connecting to MySQL using a blank password. The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Please set the password for root here. New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : n ... skipping. 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? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL 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? (Press y|Y for Yes, any other key for No) : n ... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
2. mysql 로그인 하기
> sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
3. Database 생성
mysql> create database lora_db;
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> create database lora_db; Query OK, 1 row affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | lora_db | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec) mysql>
4. Table 생성
mysql> use lora_db;
mysql> create table ..... ;
mysql> use lora_db; Database changed mysql> show tables; Empty set (0.00 sec) mysql> drop table if exists GROUP_INFO; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> create table GROUP_INFO( -> SEQ bigint not null, -> NAME varchar(32), -> ICON varchar(32), -> primary key(SEQ) -> ); Query OK, 0 rows affected (0.08 sec) mysql> show tables; +-------------------+ | Tables_in_lora_db | +-------------------+ | GROUP_INFO | +-------------------+ 1 row in set (0.00 sec) mysql>
5. 사용자 등록 및 권한부여
mysql> create user 'lora'@'localhost' identified by '1234';
mysql> grant all privileges on lora_db.* to 'lora'@'localhost';
mysql> uninstall plugin validate_password; Query OK, 0 rows affected (0.07 sec) mysql> create user 'lora'@'localhost' identified by '1234'; Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on lora_db.* to 'lora'@'localhost'; Query OK, 0 rows affected (0.00 sec)
6. Password 정책 해제방법
mysql> uninstall plugin validate_password;
> sudo apt update
> sudo apt install mysql-server
2. mysql 설정하기
> sudo mysql_secure_installation
2. mysql 로그인 하기
> sudo mysql -u root
3. Database 생성
mysql> create database lora_db;
4. Table 생성
mysql> use lora_db;
mysql> create table ..... ;
5. 사용자 등록 및 권한부여
mysql> create user 'lora'@'localhost' identified by '1234';
mysql> grant all privileges on lora_db.* to 'lora'@'localhost';
6. Password 정책 해제방법
mysql> uninstall plugin validate_password;