Thursday, September 25, 2008

How to reset a Forgotton Password in MYSQL

ever forgotton your root password for your mysql database, or any other users password for that matter, no problem here
simply stop mysql by typing
/etc/init.d/mysqld stop

then restart Mysql with the following command

mysqld_safe --skip-grant-tables

You should see mysqld start up successfully. Now you should be able to connect to mysql without a password.

mysql --user=root mysql

update user set Password=PASSWORD('new-password');
flush privileges;
exit;

once done restart mysql normally

/etc/init.d/mysqld restart

Shaaawiiing

Wednesday, September 17, 2008

How to add multiple users and passwords to your system

for names in user1 user2 user3 user4 user5
do
useradd $names
echo "anypassword" | passwd --stdin $names
done

or you can type it all in one line and hit enter like so

for names in user1 user2 user3 user4 user5;do useradd $names;echo "anypassword" |passwd --stdin $names;done



the above will add user1 , user2 ,user3, user4 and user5 to your system.
All users will have the password "their user name followed by anypassword"
You could have your list of users in a text file and enter the commands like so, presuming your text file is called users.txt and in your text file you just insert the user names underneath one another eg

user1
user2
user3

etc

for names in `cat users.txt`
do
echo $names
useradd $names
done

If you want to add usernames and passwords from a list, then make a text file like so

user1:password1
user2:password2
user3:password3

etc
save the file , in this example we'll save it as userlist.txt
then

for names in `cat userlist.txt`
do
user=`echo $names | cut -f1 -d:`
pwd=`echo $names | cut -f2 -d:`
useradd $user
echo $pwd | passwd --stdin $user
done

Monday, September 1, 2008

How to remove @#$ Annoying Console beeps

To Remove all console beeps whilst running X type
xset b off

this will disable the annoying console beeps for all programs.

To remove the console beep when running in run level 1 2 or 3 without X, or on one of the virtual consoles ( cntrl-Alt 1 to 6) type

setterm -blength 0