yum 安装 MYsql:        yum install mysql mysql-server mysql-devel -y

1.1

登入报错:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解决办法:
# service mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# service mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>

2 查看开机启动: chkconfig --list |grep mysql

3修改mysql user(用户) password(密码) 修改登入密码

方法1: 用SET PASSWORD命令
首先登录MySQL。
格式:mysql> set password for 用户名@localhost = password('新密码');
例子:mysql> set password for root@localhost = password('123');

方法2:用mysqladmin
格式:mysqladmin -u用户名 -p旧密码 password 新密码
例子:mysqladmin -uroot -p123456 password 123

该方法可用:
方法3:用UPDATE直接编辑user表
首先登录MySQL。
mysql> use mysql;
mysql> update user set password=password('123') where user='root' and host='localhost';
mysql> flush privileges;

方法4:在忘记root密码的时候,可以这样
以windows为例:
1. 关闭正在运行的MySQL服务。
2. 打开DOS窗口,转到mysql\bin目录。
3. 输入mysqld --skip-grant-tables 回车。--skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证。
4. 再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysql\bin目录。
5. 输入mysql回车,如果成功,将出现MySQL提示符 >。
6. 连接权限数据库: use mysql; 。
6. 改密码:update user set password=password("123") where user="root";(别忘了最后加分号) 。
7. 刷新权限(必须步骤):flush privileges; 。
8. 退出 quit。
9. 注销系统,再进入,使用用户名root和刚才设置的新密码123登录。

4开启远程连接:

创建用户用来远程连接

GRANT ALL PRIVILEGES ON *.* TO 'chen'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

(第一个chen表示用户名,%表示所有的电脑都可以连接,也可以设置某个ip地址运行连接,第二个123456表示密码)。
指定192.168.1.127 IP可连接 chen 数据库 :

GRANT ALL PRIVILEGES ON *.* TO 'chen'@'192.168.1.127' IDENTIFIED BY '123456' WITH GRANT OPTION;

5 设置防火墙 或 关闭 iptables -F
设置防火墙 iptables 重启防火墙 service iptables restart
vim /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

yum 安装 Mysql error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 开启远程连接 修改登入密码 忘记root密码 配置防火墙规则 随手mark的更多相关文章

  1. ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

    cmd mysql -h localhost -u root -p r然后报错 ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost ...

  2. Mysql忘记密码:关于ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)的问题

    命令行登录mysql时,出现ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)的提示. ...

  3. mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES)

    mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES) 解 ...

  4. ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N O) MYSQL

    ERROR 1045 (28000): Access denied for user ODBC@localhost 刚使用mysql, 碰到这个问题.. C:\Program Files\MySQL\ ...

  5. MySQL:ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

    错误:ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) 原因 :登录帐户错误(ODB ...

  6. mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'zzq'@'localhost' (using password: YES)

    mysql中有新建了一个%(允许所有主机连接)和ALL权限的账户.但是竟然连不上.用root或者其他localhost的用户却可以登录.首先检查下防火墙打开了没,可以用service iptables ...

  7. ERROR 1045 (28000): Access denied for user 'xxx'@'localhost' (using password: YES)【奇葩的bug】

    #  Bug描述 今天周末,在家里学点新技术,虽然公司分配的任务没有完成(滑稽滑稽) 我先创建了一个mysql数据库,用root用户创建一个新用户,毕竟项目中使用root是非常危险的,尤其是我这样的实 ...

  8. ERROR 1045 (28000): Access denied for user 'mycat'@'localhost' (using password: YES)

    创建用户: mysql> grant all on db1.* to mycat@'%' identified by '123456'; Query OK, 0 rows affected (0 ...

  9. ERROR 1045 (28000): Access denied for user 'hive'@'localhost' (using password: YES)

    [root@master native]# mysql -uhive -pEnter password: ERROR 1045 (28000): Access denied for user 'hiv ...

随机推荐

  1. eclipse不能启动,An internal error occurred during: "reload maven project".

    An internal error occurred during: "reload maven project". 这个错误是因为项目已经关闭,导致 导致此问题的原因是Sprin ...

  2. wdcp升级php5.8到php7.1.12后安装禅道

    ()下载禅道安装包 http://www.zentao.net/download/zentao10.0.beta-80076.html ()安装禅道 http://www.zentao.net/boo ...

  3. bootstrap修改数据刷新页面跳转到当前页的问题

    修改按钮的页面的方法里添加如下代码 1      var pn = $("#datatable").bootstrapTable('getOptions').pageNumber; ...

  4. 使用 Doxygen 生成文档 (以FFmpeg 4.1.1 为例)

    背景 在查找 ffmpeg 文档的时候,发现其文档是根据 Doxygen 生成的. 为了学习方便,这里以 生成 ffmpeg 4.1 文档 为例. 注:为了兼顾 arm 与 host ,本人选择了同时 ...

  5. node批量修改文件名称

    let fs = require('fs');//引用文件系统模块 let PATH = `./app_zijietiaodong/`;//当前文件夹 let ext = { readFileList ...

  6. CSS - flex使行内元素快速对齐

    div{ display:flex; alian-items:center; //使垂直对齐 justify-content:center //使水平对齐 }

  7. jenkins#构建并部署springboot的jar包

    0. 前提是有一个可以用的没有问题的Jenkins环境,这是基础 1. 安装publish over ssh 插件,(如果网速太慢,请去github 克隆代码,然后自己构建,然后上传安装此插件) 2. ...

  8. C++中数字与字符串之间的转换 scanf string总结(复习必读)

    1 string的scanf读入操作 C++里面控制台输入直接使用cin操作就可以了:或者getline(istringstream,string); 字符和数字加减就是字符的ASCII码和数字直接加 ...

  9. [Codeforces #608 div2]1271A Suits

    Description A new delivery of clothing has arrived today to the clothing store. This delivery consis ...

  10. git下载安装、配置及idea初始化

    安装 wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.0.tar.gz git 安装依赖 yum -y insta ...