mysql用户认证协议更换(mysql使用问题)
安装好mysql后,在使用mysq时,出现了如下问题.
java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:327)
at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
at java.sql.DriverManager.getConnection(DriverManager.java:523)
MYSQL 4.1以后, 采用了一种新的用户认证协议, 对于老的客户端会出现不支持认证协议的错误, 以下是官方网站的解决方法﹔
1When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
使用以前建立的账号连接,对于在新的认证协议下建立的账户就不行了
3Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function: mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Alternatively, use UPDATE and FLUSH PRIVILEGES: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
Substitute the password you want to use for ``newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one.
这是一个不错的办法,新建立的账号采用老式的加密协议
4Tell the server to use the older password hashing algorithm:
Start mysqld with the --old-passwords option.
这样新认证协议的优点就没法使用了
5Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query: mysql> SELECT Host, User, Password from mysql.user
-> WHERE LENGTH(Password) > 16;
For each account record displayed by the query, use the Host and User values and assign a password using th
相关文档:
解决MySql数据乱码:
1 写过滤器设置编码格式(格式和JSP页面的编码一样),或则在请求里面写request.setCharacterEncoding("编码方式");
2 如果是查询出数据乱码,在链接的URL上加上编码格式(你这里加了,没问题);
3 修改my.ini文件里面的 default-character-set= 您要的编码格式 (一共有两处,你查找一下 改为一样的编 ......
使用整数数据的精确数字数据类型。
bigint
从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字)。存储大小为 8 个字节。
int
从 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,647) 的整型数据(所有数字)。存储大小为 4 个字节。int 的 SQL-92 同义字为 integer。
smallin ......
得安奇专卖(运动休闲鞋,板鞋)淘宝小店:www.bxbshoes.com
substring:
语法
SUBSTRING ( expression , start , length )
参数
expression
是字符串、二进制字符串、text、image、列或包含列的表达式。不要使用包含聚合函数的 ......
MYSQL在 C API 中可用的函数:
mysql_affected_rows()
返回被最新的UPDATE, DELETE或INSERT查询影响的行数。
mysql_close()
关闭一个服务器连接。
mysql_connect()
连接一个MySQL服务器。该函数不推荐;使用mysql_real_connect()代替。
mysql_change_user()
改变在一个打开的连接上的用户和数据库。
mysql_ ......