千家信息网

mysql怎么设置root密码

发表于:2024-10-11 作者:千家信息网编辑
千家信息网最后更新 2024年10月11日,本篇内容介绍了"mysql怎么设置root密码"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成![roo
千家信息网最后更新 2024年10月11日mysql怎么设置root密码

本篇内容介绍了"mysql怎么设置root密码"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

[root@centos bin]# service mysqld stop
Shutting down MySQL.[ OK ]
[root@centos bin]# ./mysqld_safe --skip-grant-tables&
[1] 21267
[root@centos bin]# 2016-05-16T18:14:00.092388Z mysqld_safe Logging to '/soft/data//centos.err'.
2016-05-16T18:14:00.120089Z mysqld_safe Starting mysqld daemon with databases from /soft/data/


[root@centos bin]#
[root@centos bin]# mysql -u root mysql
-bash: mysql: command not found
[root@centos bin]# ./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 2
Server version: 5.7.12 Source distribution


Copyright (c) 2000, 2016, 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> update user set password=PASSWORD("root") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql>
mysql>
mysql> use mysql
Database changed
mysql> update user set password=PASSWORD("root") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql>
mysql>
mysql>
mysql> select user from user;
+-----------+
| user |
+-----------+
| mysql.sys |
| root |
+-----------+
2 rows in set (0.00 sec)


mysql> desc user
-> ;
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(32) | NO | PRI | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| Create_tablespace_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) unsigned | NO | | 0 | |
| plugin | char(64) | NO | | mysql_native_password | |
| authentication_string | text | YES | | NULL | |
| password_expired | enum('N','Y') | NO | | N | |
| password_last_changed | timestamp | YES | | NULL | |
| password_lifetime | smallint(5) unsigned | YES | | NULL | |
| account_locked | enum('N','Y') | NO | | N | |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
45 rows in set (0.00 sec)


mysql> update user set authentication_string=PASSWORD("root") where user='root';
Query OK, 1 row affected, 1 warning (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 1


mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


mysql> exit
Bye
[root@centos bin]# service mysqld restart
Shutting down MySQL.2016-05-16T18:16:32.859231Z mysqld_safe mysqld from pid file /soft/data/mysql.pid ended
[ OK ]
Starting MySQL.[ OK ]
[1]+ Done ./mysqld_safe --skip-grant-tables
[root@centos bin]#
[root@centos bin]#
[root@centos bin]#
[root@centos bin]# mysql -u root -p root
-bash: mysql: command not found
[root@centos bin]# ./mysql -u root -p root
Enter password:
ERROR 1049 (42000): Unknown database 'root'
[root@centos bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.12


Copyright (c) 2000, 2016, 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> exit
Bye
[root@centos bin]#
[root@centos bin]#
[root@centos bin]#

"mysql怎么设置root密码"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!

密码 内容 更多 知识 实用 学有所成 接下来 困境 实际 情况 文章 案例 编带 网站 行业 过程 高质量 学习 有关 输出 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 中国武术名家数据库 条件 教授 ps属于应用技术还是网络技术 互联网科技 节能减排 网络技术讨论 战地1服务器序号 搜学校是用什么软件开发 思安信息网络安全 远程处方软件开发商 我的世界服务器为什么不能用熔炉 惠普服务器厂家 极玩网络技术有限公司 网络安全问题与信用问题 用友票据通数据库改年结标识 小学生网络安全教育图 java获取服务器时间 什么是直接访问数据库和不直接 数据库的配置文件在哪 中国网络后台服务器简称 服务器调用第三方服务发送错误 植物大战僵尸2代理服务器黑科技 嘉定区会计软件开发客户至上 web网络安全相关书籍 mysql 停止数据库 深圳奥贝网络技术有限公司 软件开发需要多少费用 戴旭教授谈网络安全 局域网dhcp服务器什么意思 软件开发公司真实流程 语音聊天软件开发售后服务怎样 东莞旅游软件开发方案
0