首页 > 技术文章 > MYSQL 有ERROR 1044

vincent-guo 2013-12-22 00:01 原文

先停了mysql,然后找到my.cnf文件,

在[mysqld]加skip-grant-tables

保存,退出

然后

vincent-guo:bin vincent$ mysql -u -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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> show databaes;
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 'databaes' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| alldata |
| emailsys |
| microlife |
| mysql |
| performance_schema |
| test |
+--------------------+
7 rows in set (0.07 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=password('P@ssw0rd') where use = 'root';
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 'use = 'root'' at line 1
mysql> update user set password=password('P@ssw0rd') where user = 'root';
Query OK, 3 rows affected (0.04 sec)
Rows matched: 4 Changed: 3 Warnings: 0

mysql> select user from user;
+------+
| user |
+------+
| root |
| root |
| root |
| |
| |
| root |
+------+
6 rows in set (0.04 sec)

mysql> delete from user where user='';//删除用户名为空的用户
Query OK, 2 rows affected (0.04 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>

推荐阅读