作者:雨天是最美 | 来源:互联网 | 2014-05-29 08:43
mysql数据库安装完成后,mysql默认root用户没有密码1.修改密码数据库安装目录:/user/local/mysql[root@AY13052612210820701aZbin]/user/local/mysql/bin/mysqlmysql-urootMariaDB[mysql]UPDATEuserSETPa
mysql数据库安装完成后,
mysql默认root用户没有密码
1.修改密码
数据库安装目录:/user/local/mysql
[root@AY13052612210820701aZ bin]/user/local/mysql/bin/mysql
mysql -u root
MariaDB [mysql]> UPDATE user SET
Password=PASSWORD('newpwd') WHERE User='root';
MariaDB [mysql]>FLUSH PRIVILEGES;
MariaDB [mysql]>exit;
密码修改完成后重新登录
[root@AY13052612210820701aZ bin]/user/local/mysql/bin/mysql
mysql -u root -p
注意:要带上p参数,需要密码登录,否则提示错误 ERROR 1045 (28000): Access denied
for user 'root'@'localhost' (using password: NO)
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or
\g.
Your MariaDB connection id is 74
Server version: 5.5.31-MariaDB-log Source distribution
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and
others.
Type 'help;' or '\h' for help. Type '\c' to clear the current
input statement.
MariaDB [mysql]>
成功登录