站内搜索: 请输入搜索关键词
当前页面: 图书首页 > MySQL Tutorial

MySQL Tutorial

[ Directory ] Previous Section Next Section

Setting the Root Password

As you probably noticed when you logged in just now, you had to supply a username?TT>root梑ut not a password. The initial installation of MySQL has no root password set. It's really important to set this password for obvious security reasons. In the MySQL monitor, type the following:


set password for root@localhost=password('your password');

Obviously, you should replace your password with whatever you would like the root password to be.

Log out (\q) and then log back in. This time, you need to log in like this:


mysql -u root -p

MySQL then prompts you for your password. The -u means username, and the -p means log in with password.

    [ Directory ] Previous Section Next Section