상단

MySQL


MySQL 설치 in Ubuntu

apt  -y  update
apt  -y  upgrade

apt  install  mysql-server
mysql_secure_installation

vi  /etc/mysql/mysql.conf.d/mysqld.cnf
    bind-address = 0.0.0.0
    
systemctl  restart  mysql.service
systemctl  enable   mysql.service

pip3  install  pymysql

데이터베이스와 사용자 생성

DATABASE="~"
USER="~"
PASSWD="~"
ROOT_PASSWD="~"

mysql  -uroot  -p${ROOT_PASSWD}  mysql
    create database ${DATABASE};
    show databases;

    grant all privileges on ${DATABASE}.* to ${USER}@localhost identified by '${PASSWD}';
    grant all privileges on ${DATABASE}.* to ${USER}@'%' identified by '${PASSWD}';
    flush privileges;

    select Host, User, Password from user order by User, Host;
    select Host, Db, User from db order by User, Db, Host;
    exit

mysql  -u${USER}  -p${PASSWD}  ${DATABASE}
최종 수정일: 2024-09-30 12:26:18

이전글 :
다음글 :