---
title: "Mysql Remark"
author: "ieniac"
date: "2009-08-09T13:04:40Z"
tags: ["HTML", "JDBC", "MySQL"]
categories: ["数据库"]
slug: "mysql-remark"
draft: false
lastmod: "2010-04-16T15:39:14Z"
id: 443262
url: "https://ieniac.iteye.com/blog/443262"
---

1\. jdbc url

 

```
jdbc:mysql://IP:3306/dbName?useUnicode=true&characterEncoding=GBK
```

 

2\. user privileges 更改用户权限后记得

```
flush privileges;
```

 

 

3\. 导入数据表 大小写 在 my.ini 中添加 如下配置

```
# Identifier Case Sensitivity 
# http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html lower_case_table_names=2
```

 

 

4\. deal with field value is NULL

如果expr1不是NULL, IFNULL()返回expr1, 否则它返回expr2. IFNULL()返回一个数字或字符串值, 取决于它被使用的上下文环境.

```
IFNULL(expr1,expr2) 
```

 

 

 5. mysql  System DSN ODBC

```
http://www.mysql.com/products/connector/
```

 

 

 6. MySQL Syntax to get the identity (object\_id) of inserted row After insert

 

```
SELECT LAST_INSERT_ID();
```

 

 

 

 7. Generate Remote User

```
GRANT ALL PRIVILEGES ON *.* TO ‘username’@‘host’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
```

 

 8. phpMyadmin更改mysql權限密碼後無法登入 

```
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('password');
```