mysql碰见问题(集)

此文章做为 mysql 问题记录: php

1. select * from `Passport` where `PassportID`={$passportID} mysql

遭遇问题的就是这样一条语句 ,咋一看没错,可是问题就出在where以前的空格上,由于在coding与同事交流,手误输入了全角空格,致使语法错误 sql

2. php 代码: $sql = "select * from `Passport` where unix_timestamp({$date_start})>unix_timestamp({$date_end})"; 数据库

上面的语句中,日期没有引号引发, 并不会报错。 在mysql中 unix_timestamp(2012-12-12) 返回的值为0 this

3. MySQL Server Error: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file ( 2000 ) spa

4. unix

1093 - You can't specify target table 'ordercw' for update in FROM clause

不能对一张表中的数据 , 查询出来更新或删除 code

处理的方法是使用, 建立临时表 , 而后在进行处理 ip

create table 临时表 as select XXX as XXXOther from 原先表;
delete from 原先表 where id  in (select XXXOther   from 临时表); 
drop table 零时表;

 

5. 根据条件导出数据库中某种表中数据 ci

mysqldump -u root -p database --no-create-db=TRUE --no-create-info=TRUE --add-drop-table=FALSE --where="XXX" table>file_path;

相关文章
相关标签/搜索