Thursday, November 18, 2010

mysql access denied for user 'root@localhost' using password yes

we are getting the comman error for phpmyadmin login
or doing the new set of mysql and trying to connect mysql

mysql access denied for user 'root@localhost' using password yes

Solution

root@localhost$ mysqladmin -u root password NEWPASSWORD
 
OR you want to update 
 
root@localhost$ mysqladmin -u root -p 'OLDPASSWORD' password NEWPASSWORD 
 
issue get resolved...
 
if still issue try to do following...
 
1) Restart mysql 
service myqsql restart

if still issue do following

1) execute following command
$ mysql
mysql > use mysql
mysql > UPDATE mysql.user SET Password=PASSWORD("*******")WHERE User="root";
mysql > FLUSH PRIVILEGES; 
mysql > quit;  
 
 

Update the root password for mysql database

To update the password of mysql database for root user

1) Login in into mysql prompt.

mysql>UPDATE mysql.user SET Password=PASSWORD("*******") WHERE User="root";
mysql>FLUSH PRIVILEGES;

done.

Wednesday, November 17, 2010

check/repair file system - Linux

Use fsck command to check/repair file system in linux 

e.g
1) if file system is ext3 and you want to check the disk mounted on sda1 then use following command
fsck -t ext3 /dev/sda1


1) if file system is ext4 and you want to check the disk mounted on sda2 then use following command

fsck -t ext4 /dev/sda2


How to check which file system is installed.
Run following command

mount

How to check the mounted file system,
Run following command

fdisk -l

Thursday, May 20, 2010

<style>
html, body {
height: 100%;
}
#container {
min-height: 100%;
margin-bottom: -80px;
position: relative;
}
#footer {
height: 80px;
position: relative;
}
.clearfooter {
height: 80px;
clear: both;
}
</style>

<html>
<body>
<div id="container">
<div id="header">Header</div>
<div id="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
</ul>
</div>
<div id="content">Content Here.</div>

<div class="clearfooter"></div>

</div><!--End Container-->

<div id="footer">Footer Here.</div>
</body>
</html>

Stay footer always bottom








Content Here.








Tuesday, March 9, 2010

Play WMV in Browser

1) Replace "http://www.example.com/myfile.wmv" with your file name.
2) Replace "[" with "<"
3) Replace "]" with ">"


[object id="MediaPlayer" width=640 height=480 classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"]
[param name="filename" value="http://www.example.com/myfile.wmv"]
[param name="Showcontrols" value="True"]
[param name="autoStart" value="FALSE"]
[embed type="application/x-mplayer2" src="http://www.example.com/myfile.wmv" width=640 height=480][/embed]
[/object]

Enjoy the code

Tuesday, February 9, 2010

One to Many Relation in RDBMS single SQL to fetch data

Many times we need a single sql that fetch the data from one to many relation ship.
in mysql database we can achive this with the help of OUTER JOIN.

let say employee table having the record with emp_id and each employee have multiple contact number in table emp_contact so we fetch the record in single sql employee with there contact list.

SELECT
emp.*,
con.contact_number_list
FROM
emp
LEFT OUTER JOIN (
SELECT emp_id, GROUP_CONCAT( CAST(contact_num as CHAR ) ) as contact_number_list
FROM emp_contact
GROUP BY emp_id
) AS con ON con.emp_id = emp.emp_id