web analytics

mySQL: How to reset root password

If the password for the mysql “root” user is lost, it’s still possible reset it to some other value. The restart of the mySQL server will be necessary, of course.

The following should be done:

Stop the server It could be done normally:

/etc/init.d/mysql stop

or effectively:

ps -ef | grep mysql … mysql 25079 […]

AIX: reset user password

Change the password for the user (as root):

passwd username

Reset the login counter and unlock the user:

chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s username chuser "account_locked=false" username

Reading password in Unix shell

print -n "Enter Your password:" stty_orig=`stty -g` trap "stty ${stty_orig}; exit" 1 2 3 15 stty -echo >&- 2>&- read PASS stty ${stty_orig} >&- 2>&- trap 1 2 3 15 print

trap :catches interruptions. I.e. if the user presses Ctrl+C, the normal stty mode is set before stopping the program stty -echo :switches off the […]

Oracle: password function

Find the name of the current password function

SELECT * FROM DBA_PROFILES WHERE RESOURCE_NAME=’PASSWORD_VERIFY_FUNCTION’;

Change the password function for the profile:

ALTER PROFILE &PROFILE. LIMIT PASSWORD_VERIFY_FUNCTION &function_name.;

Example of the password function:

CREATE OR REPLACE FUNCTION dummy_func  (USERNAME VARCHAR2, PASSWORD VARCHAR2, OLD_PASSWORD VARCHAR2)  RETURN BOOLEAN IS  BEGIN    IF NLS_LOWER(password) = NLS_LOWER(username) THEN     […]