MySQL common application exception record

>>Error Code: 1045. Access denied for user 'test'@'%' (using password: YES)

Using MySQL select * into outfile '/tmp/rs.txt' encounter this problem from tb_name to export the results,

Although the current user has full authority, but need to grant permission to file separately, using the root user:

1
grant  file  on  *.*  to  test@localhost;

>>Error Code: 1093. You can't specify target table 'mytable' for update in FROM clause

When using the update or delete statement, inside where the conditions to join the sub-query caused.
This time can reintroduce the nested layer, i.e. "(select * from table) tt ", to arrive at a temporary result set,
the operation in this result set it.

1
2
delete  from  mytable  where  mytable.id  not  in
( SELECT  tt.id  FROM  ( SELECT  FROM  mytable) tt  where  tt.siteid=22 );  

>>Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode,

toggle the option in Preferences -> SQL Editor and reconnect.

The solution is to turn off safe mode:

1
SET  SQL_SAFE_UPDATES = 0;  

Note that if you are using MySQL Workbench, also need to configure the software preferences.
Because the default security settings MySQL Workbench is not batch update table.
When the SQL statement to be executed is a batch update or delete will prompt the error.
Solutions are as follows:
Open Workbench menu [Edit] -> [Preferences ... ]
is switched to [SQL Editor] page of
the [Forbid UPDATE and DELETE statements without ( safe updates) a WHERE clause] to remove the check mark before
clicking [OK ] button


When you insert the current time >> MySQL

NOW () function to ` 'YYYY-MM-DD HH : MM: SS' returns the current date and time, can be stored directly into DATETIME column.
CURDATE () to return to today's date 'YYYY-MM-DD' format, can be stored directly in a DATE field.
CURTIME () to return the current time 'HH:: MM SS' format, can be stored directly into the TIME field.

1
insert  into  table  (id , time values ( '1' ,NOW() )

 

>>Error Code: 1100. Table 'mytable' was not locked with LOCK TABLES

I performed before insertion

1
LOCK TABLES `mytable` WRITE;

Can be unlocked again:

1
UNLOCK TABLES;

Guess you like

Origin www.cnblogs.com/yuhuameng/p/11563312.html