#/usr/local/mysql/bin/mysql
[root@ftp bin]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 687 to server version: 3.23.58
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
mysql> show databases;
+--------------+
| Database |
+--------------+
| mysql |
| test |
+--------------+
2 rows in set (0.00 sec)
mysql>quit
#chrootuid /chroot/mysql mysql /usr/local/mysql/libexec/mysqld &
#/usr/local/mysql/bin/mysql -uroot
.......
mysql>SET PASSWORD FOR root@localhost=PASSWORD('new_password');
要尽量养成在mysql下输入密码的习惯,因为Shell下面输入的时候可能会被其它人看见。
mysql>use mysql;
mysql>update user set user="wghgreat" where user="root";
mysql>select Host,User,Password,Select_priv,Grant_priv from user;
mysql>delete from user where user='';
mysql>delete from user where password='';
mysql>delete from user where host='%';
mysql>drop database test;