2013年7月24日 星期三

MySQL伺服器設定使用mysqld

my.ini內容
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = D:/MySQL
datadir = D:/MySQL/data
port = 3306
# server_id = .....
character-set-server = utf8
collation-server = utf8_general_ci


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Batch啟動檔
cd bin
mysqld --install
net start mysql

Batch停止檔
net stop mysql
bin\mysqld --remove

設定密碼
mysqladmin -u root password YOUR-PASSWORD

修改密碼
cd bin
rem mysqladmin -u root password '123456'
mysql -u root -p
rem use mysql
rem update user set password=PASSWORD('123456') where user='root';

備份資料庫 - 方法1
cd bin
mysqldump test -u root -p > d:\test.sql.bak

備份資料庫 - 方法2
mysqldump -u username -p database --single-transaction >dump.sql

還原資料庫
cd bin
mysql test -u root -p < d:\test.sql.bak
自動安裝
mysqld --install
手動安裝
mysqld --install -manual

2013年7月12日 星期五

背景執行Node.JS的套件

安裝指令:
npm install -g forever
執行指令:
forever start app.js
查看指令:
forever list
停止指令:
forever stop 0