一下就能看到了。
----------------------------------------------------------
mysql> create table if not exists foo(
-> id int(10) unsigned not null auto_increment,
-> str varchar(100) not null,
-> primary key (id))
-> engine=myisam;
Query OK, 0 rows affected (0.09 sec)
insert into foo values (1,"b");
mysql> show processlist;
+----+------+----------------+-------+---------+------+--------------+----------
--------------------+
| Id | User | Host | db | Command | Time | State | Info
|
+----+------+----------------+-------+---------+------+--------------+----------
--------------------+
| 26 | root | localhost:3332 | zhang | Query | 146 | Sending data | select sl
eep(12345) from foo |
| 28 | root | localhost:3371 | zhang | Query | 26 | Locked | update fo
o set str='c' |
| 29 | root | localhost:3378 | NULL | Query | 0 | NULL | show proc
esslist |
+----+------+----------------+-------+---------+------+--------------+----------
--------------------+
3 rows in set (0.02 sec)
mysql>
把现在错误信息写进错误日志中去:
C:\Documents and Settings\Administrator>mysqladmin debug
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'ODBC'@'localhost' (using password: NO)'
C:\Documents and Settings\Administrator>mysqladmin debug -uroot -p123456
C:\Documents and Settings\Administrator>mysqlbinlog 飞think-bin.000097
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
mysqlbinlog: File '飞think-bin.000097' not found (Errcode: 2)
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
C:\Documents and Settings\Administrator>
如何开启mysql的日志?
a)修改mysql的配置文件my.ini:
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#mysql日志位置
log-error="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/log/error.log"
log="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/log/mysql.log"
long_query_time=2
log-slow-queries= "E:/PHP/mysql/mysql5_install/MySQL Server 5.0/log/slowquery.log"
#Path to installation directory. All paths are usually resolved relative to this.
basedir="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/"
#Path to the database root
datadir="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/Data/"
# The TCP/IP Port the MySQL Server will listen on
port=3306
#mysql日志位置
#log-error="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/log/error.log"
#log="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/log/mysql.log"
#long_query_time=2
#log-slow-queries= "E:/PHP/mysql/mysql5_install/MySQL Server 5.0/log/slowquery.log"
#Path to installation directory. All paths are usually resolved relative to this.
basedir="E:/PHP/mysql/mysql5_install/MySQL Server 5.0/"
查询mysql的日志情况是否关闭:
mysql> show variables like 'log_%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin | OFF |
| log_bin_trust_function_creators | OFF |
| log_error | .\ |
| log_queries_not_using_indexes | OFF |
| log_slave_updates | OFF |
| log_slow_queries | OFF |
| log_warnings | 1 |
+---------------------------------+-------+
7 rows in set (0.00 sec)
mysql>
-----------------------------
查看mysql的进程和端口号是否启动?
C:\Documents and Settings\Administrator>find /?
在文件中搜索字符串。