Linuxインストールmysqlで発生したエラーと解決方法


一、パスワードの変更
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

パスワードの変更
set password for 'root'@'localhost'=password('12345678');

でもまた次の間違いを報告します
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('12345678')' at line 1

やり方を変えて成功した
mysql> alter user'root'@'localhost' identified by '12345678'; 
Query OK, 0 rows affected (0.01 sec)

二、ユーザーは授権できない
ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysqlデータベースのuserテーブルの特定のユーザ(root)のhostの属性値がlocalhostであるため、ユーザが許可できない.
mysql> update user set host='%' where user='root'; //     host   
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> grant all privileges on luckyframe.* to root@'%'; //       
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;					//    
Query OK, 0 rows affected (0.01 sec)