Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or something similar).
VI 로 해당 파일 만든다
vi /etc/yum.repos.d/mariaDB.repo
#
MariaDB 5.5 CentOS repository list - created 2014-12-16 08:14 UTC
#
http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
저장 !wq
After the file is in place, install MariaDB with:
sudo yum install MariaDB-server MariaDB-client
끝
root 패스워드와 외부 접속 설정
Mariadb root password 변경은 다음과 같이 진행합니다.
[admin@localhost ~]$ /usr/bin/mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.40-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [mysql]> update user set password=password('opennaru') where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> quit
Bye
1. MySQL(Maria DB) 로 접속 한다.
2. use mysql 명령어를 입력한다.
3. grant all privileges on *.* to 'root'@'%' identified by '비밀번호'; 입력한다.
4. flush privileges; 입력한다.
5. my.cnf 파일 내용중에서 bind-address =127.0.0.1 을 주석(#)처리 하고 저장한다.
bind-address = 127.0.0.1 => #bind-address = 127.0.0.1
정리
- mysql 서버 로그인하기
$ mysql -uroot -prootpassword mysql
- 다른 PC에서 mysql 서버로 접속을 하기 위한 사용자 추가
mysql> create user 'nayha'@'%' identified by 'password';
GRANT ALL PRIVILEGES ON salesman.* TO dbuser@IP IDENTIFIED BY '패스워드' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON imidb.* TO dbuser@localhost IDENTIFIED BY '패스워드' WITH GRANT OPTION;
- 위 사용자에게 모든 것을 할 수 있는 권한 주기
mysql> grant all privileges on *.* to 'nayha'@'%';
- 위 사용자에게 특정 DB를 관리할수 있는 권한 주기
mysql> grant all privileges on dev_test.* to 'nayha'@'%';
mysql> grant all privileges on salesman.* to 'nayha'@'%';
- 로컬PC에서 mysql로 접속하기 위한 사용자 추가
mysql> create user 'local'@'localhost' identified by 'userpassword';
- 위 사용자에게 모든 것을 할 수 있는 권한 주기
mysql> grant all privileges on *.* to 'userid'@'localhost';
- 위 사용자에게 특정 DB를 관리할 수 있는 권한 주기
mysql> grant all privileges on dbname.* to 'userid'@'localhost';