Decoding with the wrong password will give a spurious result, not an error. For example
mysql> SELECT DECODE(ENCODE('my string','mypass'),'badpass');
results in
+------------------------------------------------+
| DECODE(ENCODE('my string','mypass'),'badpass') |
+------------------------------------------------+
| aZ^ |
| @}¿? |
+------------------------------------------------+
Remember that the result of an ENCODE(), being binary, needs to be stored as a BLOB data type.
MD5(string)
MD5() returns an MD5 checksum for a given string. This is a 32-character hexadecimal number.
LAST_INSERT_ID([expr])
This function returns the last value that was inserted into an AUTO_INCREMENT column after having been
generated automatically. It refers only to values handled by the current connection to the database.
Managing a Database with mysqladmin
The mysqladmin utility is used to perform a wide range of administrative operations on a MySQL database.
It is usually run from a command line prompt.
When invoked, you should pass mysqladmin a number of options and commands that tell it how to run
and what to do.
How to Use mysqladmin
The following is the basic syntax for mysqladmin:
mysqladmin [options] command1 [cmd1_opt] command2 [cmd2_opt]
Remember that you may need to prefix mysqladmin with the path to the mysql/bin directory where it
resides.
Also, after you assign usernames and privileges to a database, you will need to use the -p and/or -u
options when invoking mysqladmin if your MySQL username is different from your UNIX username.
This tells MySQL that you are offering to provide it a username and password; if you do not and MySQL
requires them, you will receive an error message.
To summarize, the following commands can be used with mysqladmin:
create databasename Creates a new database with the specified name
drop databasename Drops (deletes) the database with the specified name
status Gives a brief status message from the server
version Displays server version information
extended-status Creates an extended status message from the server
variables Displays available variables
processlist Displays a list of active threads in the server, useful to see how busy
the server is
flush-hosts Flushes all cached hosts
flush-logs Flushes all logs
flush-tables Flushes all tables
flush-privileges Reloads the grant tables
kill id1,id2 Kills mysql threads
password new_password Changes the old password to a new password
ping Sends a "ping" signal to mysqld to check that it is functioning
reload Makes mysql reload its grant tables
refresh Flushes all grant tables and closes and opens logfiles
shutdown Shuts down the MySQL server
As well as the commands, mysqladmin can be given the following options to tell it how to run the
commands:
-#, --debug= To output to a debug log; often this is 'd:t:o,filename'.
-f, --force Dropping a database will give a warning, as will some other
commands; --force will continue even if you get such a warning.
-C, --compress Use compression in server/client protocol.