数据库

 首页 > 数据库 > mariadb > 修改MariaDB和MySQL数据库的用户密码

修改MariaDB和MySQL数据库的用户密码

分享到:
【字体:
导读:
         摘要:mysql数据库安装完成后,mysql默认root用户没有密码1.修改密码数据库安装目录:/user/local/mysql[root@AY13052612210820701aZbin]/user/local/mysql/bin/mysqlmysql-urootMariaDB[mysql]UPDATEuserSETPa...

修改MariaDB和MySQL数据库的用户密码
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]> 

成功登录
修改MariaDB和MySQL数据库的用户密码
分享到:
Ubuntu和Debian系统安? MySQL percona的...
Ubuntu和Debian系统安? MySQL percona的步骤 Percona 安?步??⒖即斯俜轿募? Percona apt Repository $ gpg --keyserver  hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A $ gpg -a --export CD2EFD2A | sudo apt-key add - vim /etc/apt/sources.list # Ubuntu 12.04, 其他版本?自行修改下述 "precise" 的...
设置MySQL数据库服务器支持远程连接的方...
设置MySQL数据库服务器支持远程连接的方法 众所周知,MySQL数据库是一种应用比较广泛的数据库系统,MySQL数据库服务器支持远程连接是MySQL数据库服务器的一种升级。 在CentOS上安装MySQL数据库服务器后,系统出于安全性考虑,缺省不支持用户通过非本机连接上数据库服务器,如果想让用户通过另外一台机器连接上...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……