Mysql必读MySQL修改root账号密码的方法
《Mysql必读MySQL修改root账号密码的方法》要点: MYSQL必读MySQL数据库中如何修改root用户的密码呢?下面总结了修改root用户密码的一些方法 MYSQL必读1: 使用set password语句修改 MYSQL必读
mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.08 sec)
mysql> set password=password('123456');
Query OK,0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK,0 rows affected (0.00 sec)
mysql> exit
MYSQL必读 MYSQL必读2: 更新mysql数据库的user表 MYSQL必读
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=PASSWORD('QwE123') where user='root';
Query OK,4 rows affected (0.03 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK,0 rows affected (0.00 sec)
mysql> quit
MYSQL必读 MYSQL必读3:使用mysqladmin命令修改 MYSQL必读命令一般为 mysqladmin -u root -p'oldpassword' password newpass 如下所示: MYSQL必读
[root@DB-Server ~]# mysqladmin -u root -p'123456' password 'Qwe123'
Warning: Using a password on the command line interface can be insecure.
MYSQL必读验证root密码修改是否成功 MYSQL必读
[root@DB-Server ~]# mysqladmin -u root -p'123456' password 'Qwe123'
Warning: Using a password on the command line interface can be insecure.
MYSQL必读 MYSQL必读上面都是在知道root密码的情况下修改root密码,如果忘记了root密码,如何修改root的密码呢? MYSQL必读1:首先停掉MySQL服务 MYSQL必读
[root@DB-Server ~]# service mysql stop
Shutting down MySQL..[ OK ]
[root@DB-Server ~]#
MYSQL必读或 MYSQL必读
[root@DB-Server ~]# /etc/rc.d/init.d/mysql stop
Shutting down MySQL..[ OK ]
MYSQL必读2:然后使用mysqld_safe命令启动mysql,更新root账号的密码 MYSQL必读??? --skip-grant-tables:不启动grant-tables(授权表),跳过权限控制. MYSQL必读??? --skip-networking :跳过TCP/IP协议,只在本机访问(这个选项不是必须的.可以不用)是可以不用 MYSQL必读
[root@DB-Server ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 5145
You have new mail in /var/spool/mail/root
[root@DB-Server ~]# 150709 14:10:53 mysqld_safe Logging to '/var/lib/mysql/DB-Server.localdomain.err'.
150709 14:10:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@DB-Server ~]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000,2014,Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql
Database changed
mysql> UPDATE user SET password=PASSWORD("Qwe123") WHERE user='root';
Query OK,4 rows affected (0.01 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK,0 rows affected (0.00 sec)
mysql> exit
Bye
MYSQL必读3:重新启动MySQL服务. MYSQL必读以上所述就是本文的全部内容了,希望大家能够喜欢 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- mysql Integer Types (Exact Value) - INTEGER, INT, SMALL
- php – 在数据库中存储差异最紧凑的方法是什么?
- Mysql学习Mysql忘记root密码怎么办
- MYSQL教程Mysqlslap MySQL压力测试工具 简单教程
- MySQL连接性能不佳
- php – Sql从另一个查询中选择多个值
- Mysql实例mysql命令行导入sql脚本中文乱码问题的解决方法
- Mysql入门mytop 使用介绍 mysql实时监控工具
- SQL Server中Money转Decimal
- MYSQL数据库mysql中char、varchar、text和nchar、nvarchar、
- java.sql.SQLException: After end of result se
- Mysql应用详细介绍基于MySQL的搜索引擎MySQL-Ful
- Mysql入门Mysql 报Row size too large 65535 的原
- 中文存数据库乱码
- Mysql实例MySQL学习第二天 安装和配置mysql winx
- SQL Server不能使用GETDATE()
- python-TypeError:execute()需要2到3个位置参数
- Mysql学习MySQL 5.5 range分区增加删除处理的方法
- Mysql学习完美转换MySQL的字符集 解决查看utf8源
- Mysql实例mysql update语句的用法详解