search
HomeDatabaseMysql TutorialMySQL的操作_MySQL

bitsCN.com

MySQL在开始配置时候会遇到一些问题当然网上处理办法很多,现在我将这些问题总结供大家参考

MySQL操作

                                                                             

准备环境

MySQL

              MySQL5.6.10下载地址: http://www.xiazaiba.com/html/361.html

       Navicat for MySQL

              Navicat for MySQL下载地址:10.1.7 http://www.xiazaiba.com/html/2122.html

安装:

       解压上述压缩包,点击安装文件进行安装,因为操作比较简单,这里就不再拿出示例图

 

启动MySQL

1、  手工启动

a)         右键->[我的电脑]->管理->服务和应用程序->服务àMySQL服务启动

备注:此时我们有时候会发现第一次安装完成之后,在服务中并没有找到MySQL这个服务项目,那该怎么办呢?

解决办法:点击【开始】à打开[MySQL 5.6 Command Line Client]查找到目标位置,这个位置为MySQL的安装位置

第一步:运行”cmd”定位到MySQL的安装目录bin下,我这里的安装目录是:

C:/Program Files/MySQL/MySQL Server 5.6/bin

第二步:输入mysqld.exe –install  得到结果”Service successfully installed”服务安装成功

第三步:再次输入net start mysql

 

这个时候提示”MySQL服务正在启动..”,”MySQL服务已经启动成功”

 

              这样我们在服务中就能查看到MySQL的服务

                    

2、  命令启动

a)         运行”cmd”,直接定位到MySQL安装目录bin文件下执行【net start mysql】

连接MySQL     

可参考网址:  http://see.xidian.edu.cn/cpp/html/1441.html

1、 连接到本机上的MYSQL。

a)       首先打开DOS窗口,然后进入目录mysql/bin,再键入命令mysql -u root -p,回车后提示你输密码.注意用户名前可以有空格也可以没有空格,但是密码前必须没有空格,否则让你重新输入密码。如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中了,MYSQL的提示符是: mysql>

 

由上图可见进入到了Mysql操作中

2、连接到远程主机上的MYSQL假设远程主机的IP为:110.110.110.110,用户名为root,密码为abcd123。则键入以下命令:
    mysql -h110.110.110.110 -u root -p 123;(注:u与root之间可以不用加空格,其它也一样)

      

3、退出MySQL命令:exit返回到bin目录下

修改数据库密码:

1、运行”cmd”进入目录mysql/bin,然后键入以下命令
      mysqladmin -u root -password ab12
注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。

注意:有时候这里会报错

 

解决办法:

直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 
# mysql -udebian-sys-maint -p 
Enter password:  
mysql> UPDATE user SET Password=PASSWORD(’sxw’) where USER=’root’ and HOST=”localhost”; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
# mysql -uroot -p 
Enter password:  
mysql> 

 

 

以上我们就修改密码成功了,这个时候Navicat这个连接又要我们重新开始连接了

 

后面修改密码都可以这样的方式去修改

bitsCN.com
Statement
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
How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

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.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

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]

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

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]

See all articles

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 agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

mPDF

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),