今天想给同事连接我电脑的上的本地数据库,然后不小心权限弄错。导致数据库都看不见了,在此做下笔记。网上都是说怎么操作liunx的,windows下的方法命令不太一样
我在mysql>后输入 show databases; 只出现information_schema和test两个数据库,mysql数据库不知道哪去了,是什么原因,做其他东西需要mysql这个数据库
还有当创建数据库时,比如 create database database_name;总出现 access denied for user ''@'localhost' to database 'database_name'
方法一:
1.关闭mysql
2.屏蔽权限
# mysqld --skip-grant-table
于是屏幕卡在不动,也没有另起一行新的。这时其实已经越过权限登录了。
3.新开起一个终端输入
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
mysql> \q
方法二:
1.关闭mysql
2.屏蔽权限
# mysqld --skip-grant-table
于是屏幕卡在不动,也没有另起一行新的。这时其实已经越过权限登录了。
3.新开起一个终端输入
# mysql -u root mysql
mysql> delete from user where USER='';
mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
mysql> \q
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools