workbench 란?
오라클로 치면 sqldeveloper 와 같은 툴로
MySQL 다룰 때 많이 사용한느 툴이다.
workbench 설치 방법
1. 설치
설치 작업은 putty에서 하지말고 리눅스 서버 안에 터미널창에서 수행
root 유저로 접속해서 수행하기
아래의 명령어를 순서대로 실행
yum install epel-release -y
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-release-el7-5.noarch.rpm -y
yum install mysql-workbench -y
마지막으로 다음 명령어 실행
mysql-workbench
2. 새로운 터미널 창을 열고 아이피 주소 확인하기
ifconfig
3. maria db에 접속할 유져를 생성
#root 유저로 접속하여 scott 유저 생성하여 orcl 권한 scott에게 주기
[root@localhost ~]# mysql -u root -p
Enter password:
##root 유저로 mariaDB 접속하여 scott 유저 생성
MariaDB [(none)]> use orcl;
MariaDB [orcl]> create user scott@'192.168.122.1' identified by 'tiger';
# orcl 에 있는 모든 권한을 scott 에게 주겠다
MariaDB [orcl]> GRANT ALL PRIVILEGES ON orcl.* to scott@'192.168.122.1';
MariaDB [orcl]> flush privileges;
MariaDB [orcl]> exit;
#scott 유저로 접속하기
[root@localhost ~]# mysql -h 192.168.122.1 -u scott -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.48-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
#scott 유저로 mysql 접속
MariaDB [(none)]> use orcl;
Database changed
MariaDB [orcl]>
4. mysqlworkbench 를 실행하여 접속 정보 기술하기
5. 접속 후 sql 코드 넣어보기
처음 시작할 때 항상
use orcl;
select * from emp;
workbench 접속방법
scott 유저에게 orcl 권한을 주었으니까
1. scoot 유저로 mariadb 접속
[root@localhost oracle]# mysql -h 192.168.122.1 -u scott -p
Enter password: #####
하여 mariadb 접속
2. use orcl;
MariaDB [(none)]> use orcl;
Database changed
3. mysql 사용
4. 빠져나올때는 exit