Home Database Mysql Tutorial 安装Mysql时出现错误及解决办法_MySQL

安装Mysql时出现错误及解决办法_MySQL

May 27, 2016 pm 01:45 PM
mysql installation

因为一时手痒痒更新了一下驱动,结果导致无线网卡出了问题。然而就算是从官网上下载了驱动各种折腾也没有弄好,心里特别堵。无奈只有重装系统这一条路了。这里表示特别难过,因为电脑上东西实在太多了,而且各种环境变量。所以建议一些对电脑特不是别精通的最好不好胡乱倒腾(像我这样的人),除非你想专门研究。

重装的悲剧就是所有的软件都得重新配置。有点不太情愿,因为毕竟没有太多的闲时间。但是,也有点小确幸,因为一直在学习其他的知识,开始的时候配置好的东西就再也没有研究过,只觉得配好了就很高兴,因为这样就可以接着做下一件事了。毕竟软件这块好多东西准备不好或者配置不好,就无法进行下面的学习。刚好借着这次机会重新配置了一下所有东西(其实说实话内心还是有点小崩溃的). 

    在装mysql这块就出了问题。其实安装过程不会出太多的问题。安装完了之后就出现了之前没有出现的错误。

代码如下:


mysql -u root -p

之后会提示你输出密码 Enterprise:000000(这是我安装过程中设置的密码)。之后就出现了Access denied for user ''@'localhost' to database 'mysql'这个错误。就是拒绝访问错误。要么密码错误要么是你的权限不够。

mysql自带有一个数据库叫mysql,里面有一个user表,存的用户信息。你可以对这些信息进行一个查询。

代码如下:


use mysql; 
show tables;  

此时会显示mysql中的所有表,最下面你可以看到有一个user表。在查询user表中的所有信息

代码如下:


select * from user;

查询结果太多,我就不截图展示了。我的总共有43个字段,4条记录。其中有三条记录的User字段都为root,一条为null;还有三条记录的Grant_priv字段为Y,一条为N。其实有些不太清楚这些为什么会有是个用户,安装的过程中我设置了一个,但其他的那三个我都不知道是什么。我会自己设置的用户应该是第四条记录,也就是最后一条。其他三个用户的大多数字段值都是Y。就最后一个用户的字段值都是N。最后一个应该是我安装过程中设置上去的那个用户。因为Grant_priv为N,所以导致出现拒绝访问的错误。解决方法为:

代码如下:


update user set Grant_priv= 'Y' where user = "你的记录的用户名字段的值" and host= "你的记录的主机的值" ;
flush privileges;

此时我的问题就解决了。因为从来没有出现过这样的错误,所以解决后就想记录下来,以作为总结。我所描述的也很浅显,如果有什么不对的地方,希望可以指正,大家互相交流。

mysql安装过程中最易出现问题及解决方案(汇总)

近日笔者在论坛上看到不少站长在问mysql安装的问题,介于此笔者就简单总结一下mysql安装中最容易出现的几个问题,供各位参考:

背景:操作系统:win7;mysql版本:mysql 5.5(64位)

1.重新安装mysql卡在最后一步过不去

问题描述:第一次安装完mysql,使用jdbc写入的中文都是乱码,但已存在于数据库中的中文数据正常,改了字符编码还是没能解决问题,于是决定重装。但重装卡在最后一步始终过不去。

解决方案:(1)在注册表里搜索mysql,删除相关记录;(2)删除mysql安装目录下mysql文件;(3)删除C:/ProgramData 目录下mysql文件夹。然后再重新安装,安装成功。

2.mysql -uroot -p登陆不上

问题描述:可以十分确定密码是正确的,但就是连不上,然后关闭mysql服务,使用mysqld --skip-grant-tables启动,可以正常连接。重新安装了很多次,都是一样的。之前安装都是在安装过程中设置了root密码。

解决方案:不要设置root密码,可以正常登陆后,再使用命令修改root密码,再次连接,就正常了(注意,为了支持中文,安装中字符编码选择utf8)。

3.正常安装后,查询出中文数据是乱码

安装好数据库后,导入数据,由于之前数据采用gbk编码,而安装mysql过程中使用utf8编码,所以查询出来数据是乱码。然后登陆mysql,使用set names gbk命令后,再次查询,中文显示正常。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles