경주장

MySQL 설치 및 Root 비밀번호 설정 본문

프로젝트/자바지기

MySQL 설치 및 Root 비밀번호 설정

달리는치타 2022. 1. 8. 01:06

MySQL 설치

apt-get install mysql-server

 

 

Root 비밀번호 설정 및 접속방식 변경

service mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root

mysql> use mysql;
mysql> update user set authentication_string=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> update user set plugin='mysql_native_password' where user='root';
mysql> flush privileges;
mysql> quit

# service mysql stop
# service mysql start
$ mysql -u root -p

 

외부 접속 허용

mysql> GRANT ALL PRIVILEGES ON *.* TO root@'61.84.6.241' IDENTIFIED BY '1234' WION;
Query OK, 0 rows affected, 1 warning (0.00 sec)