shell Öе÷Óà mysql ²Ù×÷
#!/bin/bash
#ɾ³ý100¸öÊý¾Ý¿âÖеÄ1000¸ö±íµÄ¹ýÆÚÊý¾Ý
DBHOST="127.0.0.1"
DBPWD="pwd"
DBUSER="root"
MYSQLBIN="/usr/local/mysql/bin/mysql"
for((dbindex = 0;dbindex < 100;dbindex++))
do
for((tabindex = 0;tabindex < 10;tabindex++))
do
if [ $dbindex -lt 10 ]; then
del="delete from gs_map_0${dbindex}.t_${tabindex}";
else
del="delete from gs_map_${dbindex}.t_${tabindex}";
fi
del=${del}" where Fcreate_time < UNIX_TIMESTAMP() - 86400"
bin=`${MYSQLBIN} -u${DBUSER} -p${DBPWD} -h${DBHOST} -e"${del}"`
$bin
#echo ${bin}
#echo $del >>/tmp/aaa.txt
sleep 5
done
done
#crontab configure
# 0 3 * * * clear.sh > /dev/null 2>&1
Ïà¹ØÎĵµ£º
1¡¢±à¼MySQLÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini¡¡//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf
ÔÚ[MySQLd]ÅäÖöÎÌí¼ÓÈçÏÂÒ»ÐУº
skip-grant-tables
±£´æÍ˳ö±à¼¡£
2¡¢È»ºóÖØÆôMySQL·þÎñ
windows»·¾³ÖУº
net stop MySQL
net start MySQL
linux»·¾³ÖУº
/e ......
ÏÈÓÃrootµÇ½mysql -u root -p
mysql>show databases;
mysql>use mysql;
update user set password=password('ÄãÏëÉèÖõÄÃÜÂë')
where user='root'; ......
MySQL ×Ö·û´®½ØÈ¡º¯Êý£ºleft(), right(), substring(), substring_index()¡£»¹ÓÐ mid(), substr()¡£ÆäÖУ¬mid(), substr() µÈ¼ÛÓÚ substring() º¯Êý£¬substring() µÄ¹¦Äܷdz£Ç¿´óºÍÁé»î¡£
1. ×Ö·û´®½ØÈ¡£ºleft(str, length)
mysql> select left('sqlstudy.com', 3);+-------------------------+| left('sqlstudy.com', 3) | ......
ÓÃMYSQLÓï¾ä£º
mysql -uroot -p^^^^^ -e "select * from test.table2" > d:\a.xls
ÆäÖÐtestΪÊý¾Ý¿â table2ΪÆäÖеıí d:\a.xlsΪ±íλÖà ......
×÷/ÒëÕߣºÒ¶½ðÈÙ£¨Email: £©£¬À´Ô´£ºhttp://imysql.cn£¬×ªÔØÇë×¢Ã÷×÷/ÒëÕߺͳö´¦£¬²¢ÇÒ²»ÄÜÓÃÓÚÉÌÒµÓÃ;£¬Î¥Õ߱ؾ¿¡£
Ê×ÏÈ,ÕâÆ¬ÎÄÕ´¿´âÊÇÎҵĸöÈ˾Ñé̸֮,ÊÊÓÃÓÚÎÒ³£¼ûµÄ»·¾³¼°ÏîÄ¿ÖÐ.
¸öÈ˽¨Òé,Êý¾Ý¿â×Ö·û¼¯¾¡Á¿Ê¹ÓÃutf8(HTMLÒ³Ãæ¶ÔÓ¦µÄÊÇutf-8),ÒÔʹÄãµÄÊý¾ÝÄܺÜ˳ÀûµÄʵÏÖÇ¨ÒÆ,ÒòΪutf8×Ö·û¼¯ÊÇĿǰ×îÊʺÏÓÚÊ ......