利旧原来安装的XAMPP,但使MySQL支持Transaction
一直使用Mysql,最近才了解到Mysql支持了Transaction。老了,跟不少潮流了。
那就把原来的应用改成Based On Transaction的吧。
将建表语句改成Engine=InnoDB,好像还是不行,没有想象中那么简单。
查一查,哦,发现XAMPP安装的Mysql还要修改conf文件:
XAMPP from Apache Friends is a collection of free open source apps that make it easy to install Apache distribution containing MySQL, PHP and Perl. There are four XAMPP distributions for Windows, Linux , Mac OS X and Solaris. To set up an Apache web server with XAMPP, simply download and extract XAMPP, and the Apache HTTPD web server is ready after one or two more auto-execute scripts. There are no changes to the Windows registry (unless you’re using Widows installer version of XAMPP) and it’s not necessary to edit any configuration files.
However, by default, InnoDB MySQL database storage engine is not enabled in the my.cnf configuration file. If a webmaster plans to use InnoDB features, such as one to many or many to many table relationships on foreign key constraints, or transaction-safe commands such as commit, rollback and crash recovery capabilities.
To enable the support of MySQL server on InnoDB storage engine, locate the “my.cnf” config file (normally in /installation_path/xampp/mysql/bin/ directory), and edit the my.cnf with any text editor such as vi.
Search and locate each of the following lines (except the lines in italic where they’re comments):
- Comment the following line to unskip and use InnoDB
skip-innodb
- Uncomment the following options for InnoDB database if you are using InnoDB tables.
#innodb_data_home_dir = C:/xampp/xampp/mysql/data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:/xampp/xampp/mysql/data/
#innodb_log_arch_dir = C:/xampp/xampp/mysql/data/
- Uncomment the lines and set innodb_buffer_pool_size up to 50% – 80% of RAM for optimization of InnoDB databases, try not to memory usage too high.
#set-variable = innodb
相关文档:
注:本文讨论的范围为未启用MAXDB模式的表!
今天建了一个表,里面有一个列是timestamp类型,我本意是在数据更新时,这个字段的时间能自动更新。岂知对这个类型的值还不甚了解,导致出错。发现这个字段只是在这行数据建立的时候有值,在更新的却无变化。
查找资料,发现是我 ......
java中时间戳和时间字符串之间的转换
获取当前的unix时间戳
new Date().getTime()
System.currentTimeMillis()
返回的是毫秒数,要转换long t = System.currentTimeMillis()/1000;
获取当前年月日以及时分秒
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR)) c.get(Calendar.YEAR)) c.get(C ......
如何导入.sql文件到mysql中?
C:\mysql\bin>mysql -u 用户名 -p 数据库名 < c:/test.sql (source "c:\adsense.sql" )
中间的空格是一个空格位。
同时使用200多MB的sql文件。
例如:
C:\Program Files\MySQL\bin>mysql -u root -p myrosz & ......
mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,
要修改my.cnf或者在mysql启动的时候加入一些参数。如果在my.cnf里面修改,需增加如下几行
long_query_time = 1
log-slow-queries = /var/youpath/slow.log
log-queries-not-using-indexes
long_query_time 是指执 ......
※ 关于MySQL的1067错误解决方法 ※
内容:
*************
1
安装MYSQL后更改了ROOT的密码后用
net startmysql
启动时我就遇到了这样的问题.使用以下命令后
c:\mysql\bin\mysqladmin-u root -p shutdown
再net start mysql就没有这个错误提示了!
*************
2
MySQL的1067错误
Q:我的Mysql碰到了 1 ......