프로그램/DB

mysql community server init root password

milktea.kang 2014. 11. 4. 11:37

centos 에 mysql 을 설치했는데 이놈이 미친건지 처음부터 말썽이다

초기 root 비번 설정부터 오류를!!!!!


[root@localhost ~]# /usr/bin/mysqladmin -u root -h localhost password 'mypassword'

/usr/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: NO)'



우선 서비스를 중단 한다

[root@localhost ~]# service mysqld stop



일단 무장 해제? 시키고

[root@localhost ~]# mysqld_safe --skip-grant &



쳐들어간다! 돌격!!!

[root@localhost ~]# mysql -uroot 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 MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.21 MySQL Community Server (GPL)


Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



미션! 쿼리로 비번을 변경하라

mysql> update user set password=password('mypassword') where user='root';

Query OK, 3 rows affected (0.01 sec)

Rows matched: 4  Changed: 3  Warnings: 0


mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)


mysql> quit

Bye



안전하게 서비스 내렸다가 다시 올리고 접속 해보면 된다!!

[root@localhost ~]# service mysqld stop

[root@localhost ~]# service mysqld start



'프로그램 > DB' 카테고리의 다른 글

mysql/mariadb tree query  (0) 2019.10.30
MariaDB ColumnStore 1.1.x Install Guide  (0) 2018.03.30
mysql grant schema privilege  (0) 2014.10.17
centos yum install mariadb 10.0  (0) 2014.10.14
mysql 권한 설정  (0) 2014.09.19