Ph: 11223344554433

17 February 2012

Resetting MySQL Root Password: Debian or Ubuntu

If you've forgotten your MySQL root password (or are involved with some nefarious activity), here is how you can reset that password on a Debian GNU/Linux system or an Ubuntu GNU/Linux system:

Find out the account that the system uses to start and stop MySQL (note that I've changed the password for this demo):
root#  cat /etc/mysql/debian.cnf



# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = 11223344554433
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user     = debian-sys-maint
password = 11223344554433
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

Log into MySQL with that account:
root#  mysql -u debian-sys-maint -p
Enter password:
mysql>

Change the password:
mysql>  update mysql.user set password=PASSWORD("YourNewPassW0RD") where User='root';
mysql>  flush privileges; exit;

Log into MySQL as root with your new password:
root#  mysql -u root -p
Enter password:
mysql> 


The above info is for a Debian GNU/Linux or an Ubuntu setup.  If you need to do this on a Red Hat Linux (RHEL), CentOS, or Scientific Linux system, check out this post.

Resetting MySQL Root Password: Red Hat and CentOS

If you've forgotten your MySQL root password (or are involved with some nefarious activity), here is how you can reset that password on a Red Hat (RHEL) system or a CentOS system:

Stop MySQL:
root#  service mysqld stop

Start MySQL in safe mode:
root#  mysqld_safe --skip-grant-tables &

Log into MySQL as root:
root#  mysql -u root

Reset the password:
mysql>  update mysql.user set password=PASSWORD("YourNewPassW0RD") where User='root';
mysql>  flush privileges; exit;

Log out of MySQL and stop the Safe Mode:
root#  service mysqld stop

Start MySQL in the normal mode:
root#  service mysqld start

Log into MySQL with your new password:
root#  mysql -u root -p
Enter password:
mysql>

The above info is for a Red Hat system, CentOS, or Scientific Linux setup.  If you need to do this on a Debian system, check out this post.

15 February 2012

7zip command line examples and password-protection (7z, 7za)

7zip is a nice, cross-platform compression software, similar in purpose to WinZip or GZip.  &zip can create and extract those .zip and .gz (and tar.gz) files, but it uses LZMA for its own native compression, which is a much more modern compression format.  (if you're using .rar, please stop already).

Use 7zip to create a password-protected file of a list of files and directories; note the flags -p -mhe which are REQUIRED for the password part to function!

Some basic command-line examples for using 7zip are listed below, which is run with either 7z or 7za on a GNU/Linux system, the 7za being a bit less capable but also has fewer dependencies.

To Archive the files and folders 'test/ test2/ file1 file2'
shell$ 7z a -t7z -p -mhe out-file.7z test/ test2/ file1 file2
Scanning
Updating archive out-file.7z
Enter password (will not be echoed) :
Verify password (will not be echoed) :
Everything is Ok

To List the files:
shell$ 7z l out-file.7z

And to Extract the files:
shell$ 7z e out-file.7x 

There is also a graphical (GUI) version for Windows (with the password option) and KDE's Ark can also create .7z files, but I don't see a way to do that with the password protection in KDE's Ark (yet!)

Again, note the flags -p -mhe which are REQUIRED for the password part to function.


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser