Thursday, 4 April 2013

mysql data folder corrupted

In mysql, if the datas are to be changed from one system to other each with different operating system(windows)

u can take the copy of each database in folder format & ibdata0 or ibdata1 file inside data folder. stop the service of destination system & paste them in the concerned data folder & start the service.

Instead of taking the backup and restore of each & every database u can use this method also. if ur size of ibdata file is less u cannot copy since the data may be corrupted or lost.

mysql root password security problem

In mysql if we are logging throu' username & password and the password had been forgotten
u can go thro' administrator by skipping ur username & password by clicking ctrl key .
The cancel button will be changed skip option.

startup variable -> security tab -> disable grant tables (enable them).

The username(default) & password can be changed thro' command prompt or u can go thro query browser to change the password

Tuesday, 29 January 2013

find min, max value with variables

select pk_id,pk_new_amt
FROM vw_pk_discount,(select @mi:=0 mi,@mx:=0 mx)R
where pk_id in(626,627,628,629,633,634,635) AND
'2013-01-29 10:06:28' BETWEEN pk_start_dt AND pk_end_dt and
(if(@mi<pk_new_amt,(select @mi:=pk_new_amt),0) or
if(@mx>pk_new_amt,(select @mx:=pk_new_amt),0));

to find min,max value using variables, when we use it in coding format,

we are using the variables as assignment operator with the condition checking