一:权限问题

前情提要:本来该数据库可以远程访问,后来我改了密码就发现不能远程访问,网上查找教程已经执行如下命令了,还包括重起mysql服务等等....

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
mysql> flush privileges;

mysql> select user, host from mysql.user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| root | % |
| root | %% |                              -----------这是什么东东,看起来好怪,是哪一次我不小心加上去的么
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+

但是即是本地访问还是如下,远程访问(指定ip一样是这个错误):

[root@wxy asm_1000]# mysql -h192.168.1.158 -uroot -p     -NOK
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'wxy' (using password: YES)

# mysql -hlocalhost -uroot -p123456    ---OK
...
mysql>

解决:

mysql> delete from mysql.user where Host='%%';

mysql> flush privileges;

--------------------------------------------------------------------------------------------------------------------------------------------------------

二:添加字段(未完成)

1,如果不存在则添加,如果存在则更新某个字段

create table proxy_udp_connect (
uuid varchar(32) not null,
proxyuuid varchar(32) not null,
pctype int(1) not null comment '1 master, 2 slave',
protocoltype int(1) not null comment '1 2 tcp, 3 4 udp',
client_ip varchar(40) not null,
client_port int(5) not null,
bind_ip varchar(40) not null,
bind_port int(5) not null,
bind_fd int(5) not null,
connect_count int(5) not null,
primary key (uuid,client_ip,client_port)
);

insert into proxy_udp_connect(uuid,proxyuuid,pctype,protocoltype,client_ip,client_port,bind_ip,bind_port,bind_fd,connect_count) VALUES('1','123456',1,2,'192.168.1.158',1,'192.168.2.158',11,111,1) ON DUPLICATE KEY UPDATE connect_count=1+connect_count;

--------------------------------------------------------------

> create table test (
-> int5 int(5) not null,
-> int32 int(32) not null
-> );
Query OK, 0 rows affected (0.25 sec)

mysql> describe test;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| int5 | int(5) | NO | | NULL | |
| int32 | int(32) | NO | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> insert into test values(2147483647,2147483648);
ERROR 1264 (22003): Out of range value for column 'int32' at row 1
mysql> insert into test values(2147483647,2147483647);
Query OK, 1 row affected (0.02 sec)

mysql> select * from test;
+------------+------------+
| int5 | int32 |
+------------+------------+
| 12345 | 123456789 |
| 123456789 | 2147483647 |
| 2147483647 | 2147483647 |
+------------+------------+
3 rows in set (0.00 sec)

wxy:所以,int5和int32有什么区别么

===============================================================================

01-15 18:53