MySQL的操作_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
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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

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]

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

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

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.

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

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

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.
