个人劳动,还请尊重,如若转载请注明出处。iihero@CSDN
看到有些朋友老问这个非安装版与安装版有什么区别(当然是windows平台)
干脆写了一个脚本自动为其创建mysql5服务。
脚本如下,将其放到解压以后的目录里边执行即可。
@echo off
echo "This is a demo script for auto installation of noninstall version of MySQL on Windows. "
echo "Copyright: iihero@CSDN, when you distribute it, please copy this section above the head."
echo "================================iiihero@hotmail.com====================================="
set MYSQL_HOME=%~dp0
echo MYSQL_HOME=%MYSQL_HOME%
del /F my.ini
echo [client] >> my.ini
echo port = 3306 >> my.ini
echo default_character_set=gbk >> my.ini
echo [mysqld] >> my.ini
echo default_character_set=utf8 >> my.ini
echo default_storage_engine=InnoDB >> my.ini
echo basedir=%MYSQL_HOME% >> my.ini
echo datadir=%MYSQL_HOME%/data >> my.ini
echo innodb_data_file=ibdata1:50M;ibdata2:10M:autoexte ......
mysql数值范围
tinyint -128~127 0~255
smallint -32768~32767 0~65535
mediumint -8388608~8388607 0~16777215
int -2147483648~2147483647 0~4294967295
bigint -9223372036854775808~9223372036854775807 0~18446744073709551615
java中
byte -127~128
short -32768~32767
int -2147483648~2147483647
long -9223372036854775808~9223372036854775807
......
mysql数值范围
tinyint -128~127 0~255
smallint -32768~32767 0~65535
mediumint -8388608~8388607 0~16777215
int -2147483648~2147483647 0~4294967295
bigint -9223372036854775808~9223372036854775807 0~18446744073709551615
java中
byte -127~128
short -32768~32767
int -2147483648~2147483647
long -9223372036854775808~9223372036854775807
......
/**********************by garcon1986***************************************/
错误代码如下:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)
$cd /etc/mysql
$mysql -u root -p
出现错误#1045
尝试了很多方法后,在网络上找到了解决方法。
$cd /etc/mysql
$gedit debian.cnf
找到:
user = debian-sys-maint
password = xxxxx
使用
$mysql -u debian-sys-maint -p xxxx
登录成功
mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
mysql>flush privileges
mysql>quit
此时,重新登陆
$cd /etc/mysql
$mysql -u root -p
输入新设置的密码,登录成功
mysql>
至此问题解决。 ......
E:\databases\MySQL\MySQL Server 5.1\bin>mysqldump --help
mysqldump Ver 10.13 Distrib 5.1.30, for Win32 (ia32)
By Igor Romanenko, Monty, Jani & Sinisa
This software comes with ABSOLUTELY NO WARRANTY. This is free softwa
and you are welcome to modify and redistribute it under the GPL lice
Dumping definition and data mysql database or table
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
Default options are read from the following files in the given order
C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\my.cnf E:\databases
Server 5.1\my.ini E:\databases\MySQL\MySQL Server 5.1\my.cnf
The following groups are read: mysqldump client
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit
--no-defaults&nbs ......
我的环境:
原有一mysql5.0实例,现新安装一mysql5.1,并将新的5.1实例的数据路径放在另一目录。
mysql5.1的my.ini如下
(配置my.ini的参考资料:
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
http://downloads.mysql.com/docs/mysql-windows-excerpt-5.1-en.pdf
http://dev.mysql.com/doc/refman/5.0/en/multiple-windows-servers.html
关键是几个属性:
client组、mysqld组的port要不同;
mysqld组的basedir指示mysql的安装目录;
mysqld组的datadir、innodb_data_home_dir前者是数据的目录,后者是innodb的数据目录,两者必须相同,否则会报错如下:
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/error-creating-innodb.html
100515 20:50:51 [ERROR] Plugin 'InnoDB' init function returned error.
100515 20:50:51 ......
先按照下面的表结构创建mysql_order_by_test数据表,我们用实例一点一点告诉你,MySQL order by的用法。
ORDER BY uid ASC
按照uid正序查询数据,也就是按照uid从小到大排列
ORDER BY uid DESC
按照uid逆序查询数据,也就是按照uid从大到小排列
我们来看
SELECT * from mysql_order_by_test ORDER BY uid ASC
这条语句是按照uid正序查询数据,也就是按照uid从小到大排列
返回的结果就是:
1 张三 1
2 李四 2
3 王二麻子 1
我们来看
SELECT * from mysql_order_by_test ORDER BY uid DESC
这条语句是按照uid逆序查询数据,也就是按照uid从大到小排列
返回的结果是:
3 王二麻子 1
2 李四 2
1 张三 1
SQL创建代码:
CREATE TABLE IF NOT EXISTS mysql_order_by_test (
uid int(10) NOT NULL AUTO_INCREMENT,
name char(80) NOT NULL,
sex tinyint(1) NOT NULL,
KEY uid (uid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
INSERT INTO mysql_order_by_test (uid, name, sex) VALUES(1, '张三', 1);
INSERT INTO mysql_order_by_test (ui ......