Posts tagged MySQL
After installing MySQL service, administrator should set a reasonably strong password using mysqladmin utility. In MySQL, user name of administrator is “root”. To change/set/reset password, you need to run two commands. The following shows the syntax of the commands.
[root@techpulp ~]# mysqladmin -u root password NEWPASSWORD [root@techpulp ~]# mysqladmin -u root -h HOSTNAME password NEWPASSWORD
The following commands show example usage.
[root@techpulp ~]# mysqladmin -u root password y5FxEtrh [root@techpulp ~]# mysqladmin -u root -h localhost password y5FxEtrh
As the commands you executed are stored in history file (~/.bash_history), you can avoid it by running following command before running mysqladmin utility.
[neo@techpulp ~]# echo $HISTFILE /home/neo/.bash_history More >
The RENAME TABLE statement can be used to rename an existing table in MYSQL. The following example shows how name of a table changed from tbl_old to tbl_new.
mysql> RENAME TABLE `tbl_old` TO `tbl_new`; Query OK, 0 rows affected (0.00 sec) mysql>
LIST TABLES statement can be used to view the list of tables present in a database.