MySQL 远程连接
问题:远程连接服务器的数据库
$ mysql -hserverip -uuser -ppassword
ERROR 1045 (28000): Access denied for user 'user'@'localhost'
(using password: YES)
原因:mysql.user表中没有设置远程连接
$ mysql -uroot -ppassword #用root用户在server上登录
mysql> select host, user, password from mysql.user; #查看mysql数据库user表中的信息
会发现没有远程机器的host, 当然也没有user
解决方法:
mysql> grant select, update, insert, delete on *.* to user@clientip identified by "password";
这样在远程客户端clientip就可以访问数据库了
$ mysql -hserverip -uuser -ppassword
附加:
如果想让所有的远程机器都可以用user用户访问数据库可以在服务器数据库中做如下设置
mysql> grant all on *.* to user@"%" identified by "password";
相关文档:
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
TINYINT
-128 - 127
TINYINT UNSIGNED
0 - 255
SMALLINT
-32768 - 32767
SMALLINT UNSIGNED
0 - 65535
MEDIUMINT
-8388608 - 8388607
MEDIUMINT UNSIGNED
0 - 16777215
INT 或 INTEGER
-2147483648 - 2147483647
INT UNSIGNED 或 INTEGER UNSIGNED
0 - 4294967295
BIGINT
-9223372036854775808 - 92233720 ......
drop table student;
create table student
(sno int not null unique,
sname varchar(8) not null,
ssex char(2) not null,
sage int ,
sdept varchar(20));
select * from student;
alter table student drop uniq ......
conn.php
<?php
/*
* Created on 2010-1-6
* Author:CHAUVET
* Function:连接字符串
*/
$conn=@mysql_connect("localhost","root","")or die("连接数据库出错!");
mysql_select_db("newdb",$conn);
mysql_query("set names 'gb2312'");
function ReplaceSom ......
原文转自:http://hi.baidu.com/jackli00/blog/item/21b2e242025bfa1473f05d24.html
Mysql开启日志
2008-11-18 11:23
是否启用了日志
mysql>show variables like 'log_bin';
怎样知道当前的日志
mysql> show master status;
看二进制日志文件用mysqlbinlog
shell>mysqlbinlog mail-bin.000001(要写绝对问题 ......