반응형
접속 및 db 선택
ubuntu@first-instance:~$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
사용자 조회
MariaDB [mysql]> select host, user, password from user;
+-----------+------------------+-------------------------------------------+
| host | user | password |
+-----------+------------------+-------------------------------------------+
| localhost | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| 127.0.0.1 | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| ::1 | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| localhost | debian-sys-maint | *F35A5DFB4B204DE265E97C41073062CF69939F52 |
| % | MYSQL_ID | *44445FEB578128C3C063D0CAA478D827ADB6B3B3 |
| % | root | *5162375CAAA28B177047A45FDEBFB88000306236 |
+-----------+------------------+-------------------------------------------+
7 rows in set (0.002 sec)
사용자 생성 (host가 %은 전체 허용)
MariaDB [mysql]> create user tichi@localhost identified by 'test';
Query OK, 0 rows affected (0.007 sec)
MariaDB [mysql]> select host, user, password from user;
+-----------+------------------+-------------------------------------------+
| host | user | password |
+-----------+------------------+-------------------------------------------+
| localhost | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| 127.0.0.1 | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| ::1 | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| localhost | debian-sys-maint | *F35A5DFB4B204DE265E97C41073062CF69939F52 |
| % | MYSQL_ID | *00F45FEB578128C3C063D0CAA478D827ADB6B3B3 |
| % | root | *4444375CAAA28B177047A45FDEBFB88000306236 |
| localhost | test | *8DE1BCDB7E9D8CBAED1FB1530078FD5E4D2BDCC9 |
+-----------+------------------+-------------------------------------------+
8 rows in set (0.000 sec)
권한 부여 및 저장
MariaDB [mysql]> grant all privileges on [db명].* to [계정]i@'%' identified by '[비밀번호]';
Query OK, 0 rows affected (0.003 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.003 sec)
반응형
'개발' 카테고리의 다른 글
파이썬 주식 데이터 수집 (야후 파이낸스) (1) | 2021.10.03 |
---|---|
리눅스 crontab 크론탭 (0) | 2021.07.10 |
MariaDB 설치 (우분투) (0) | 2021.03.06 |
파이썬 - 자주 쓰는 Pandas 문법 (0) | 2021.03.01 |
맥[mac] - cron Operation not permitted 에러 (0) | 2021.02.27 |