mysql 5.7 설치

DB 2019. 9. 27. 15:14

* centos 7

> wget --no-check-certificate  https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar
> tar xvf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar
> sudo yum -y localinstall mysql-community-common* mysql-community-libs* mysql-community-client* mysql-community-server-5*

# listen port : 3306
> sudo systemctl start mysqld

# 임시 비밀번호 확인 (JRpdip*S:6a#)
> grep 'temporary password' /var/log/mysqld.log

# root 비밀번호 변경
> mysql -uroot -pJRpdip*S:6a#
mysql> set password = password('Aaaa123$');

# db, user 생성
> create database testdb;
> create user 'user1'@'%' identified by 'user1A!@#';
> grant all privileges on testdb.* to 'user1'@'%';
> flush privileges;

 

 

 

 

* ubuntu 18.04

# 설치
> sudo apt-get -y install mysql-server

# root 암호 설정
> sudo mysql -u root
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
mysql> exit

# 재시작
> sudo systemctl restart mysql

# root 암호 변경 접속
> mysql -u root -p
root

# db, user 생성
mysql> create database user1;
mysql> create user 'user1'@'%' identified by 'user1';
mysql> grant all privileges on *.* to 'user1'@'%';
mysql> flush privileges;
mysql> exit

# bind-address 설정
> sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address            = 0.0.0.0

# 재시작
> sudo systemctl restart mysql