MYSql Mac 설치 & 삭제
1. Mac 에서 mysql 삭제 명령어 :
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
sudo vi /etc/hostconfig
2. 초기 비번 변경하기 :
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
상기 메시지가 나타나는 경우 .
mysql> SET PASSWORD = PASSWORD('NEW_PASSWORD');
* 상기 명령어는 다음과 같이 처음 사용자를 생성하거나, 사용자 비번 변경을 요청을 다음과 했을경우 나타난다.
ALTER USER 'jeffrey'@'localhost' PASSWORD EXPIRE;
3. 데이터베이스 목록 보기
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
4. 데이터베이스 생성 및 선택하기
mysql> create database boards;Query OK, 1 row affected (0.00 sec)5. 데이터베이스 권한을 사용자에게 부여하기.
mysql> show databases;+--------------------+
| Database |
+--------------------+
| information_schema |
| boards |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> use boards;Database changed
mysql> create user test;Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on boards to test@localhost identified by 'test';Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
6. 부여된 권환 확인하기.
mysql> show grants for test@localhost;
+----------------------------------------------------------------+
| Grants for test@localhost |
+----------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'test'@'localhost' |
| GRANT ALL PRIVILEGES ON `mysql`.`boards` TO 'test'@'localhost' |
+----------------------------------------------------------------+
2 rows in set (0.00 sec)
7. 권한 뺏기 .
mysql> revoke all on boards from test@localhost;
8. 계정 삭제하기.
mysql> drop user test@localhost;
9. 패스워드초기화
$sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
$sudo mysqld -proot mysqld
$mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('root_password') where USER='root';
$mysql> FLUSH PRIVILEGES;
EmoticonEmoticon