Home Database Mysql Tutorial MySQL 绿色版安装方法课程

MySQL 绿色版安装方法课程

Jun 07, 2016 pm 04:24 PM
mysql Install method course

MySQL 绿色版安装方法教程 MySQL 绿色版安装方法教程,需要的朋友可以参考下。 一、下载,这里使用绿色解压缩版 http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-noinstall-5.1.32-win32.zip 二、配置MySQL的参数 1、解压缩绿色版软件到D:\

MySQL 绿色版安装方法教程

MySQL 绿色版安装方法教程,需要的朋友可以参考下。
一、下载,这里使用绿色解压缩版

http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-noinstall-5.1.32-win32.zip

二、配置MySQL的参数

1、解压缩绿色版软件到D:\AppServ\MySQL
设置系统环境变量, 在Path中添加 D:\AppServ\MySQL\bin;?

?


2、修改D:\AppServ\MySQL\my-small.ini文件内容,添加红色内容

[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=gbk

[mysqld]
port = 3306
socket = /tmp/mysql.sock
default-character-set=gbk
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
basedir=D:\Appserv\MySQL\
datadir=D:\Appserv\MySQL\Data\
#basedir是mysql安装目录;#datadir是mysql数据库存放位置,必须是Data文件夹名

将修改后的文件另存为my.ini

3、安装MySQL的服务,服务名自己定义为MySQL.
1)、进入DOS窗口
2)、执行安装MySQL服务名的命令:
D:\AppServ\MySQL\bin\mysqld-nt -install mysql --defaults-file="D:\Appserv\MySQL\my.ini"
出现Service successfully installed.表示安装成功。

然后打开服务窗口(在运行框中输入services.msc即可打开服务窗口,然后可以找到mysql服务了,右键mysql服务属性,在弹出的窗口中可以看到以下信息:)
D:\AppServ\MySQL\bin\mysqld-nt --defaults-file=D:\Appserv\MySQL\my.ini mysql? 则表示mysql会随开机启动而启动!


3)、启动MySQL服务
net start mysql
MySQL服务正在启动 .
MySQL服务无法启动。

4)、登陆MySQL服务器
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.32-community MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

注意:MySQL的管理员用户名为root,密码默认为空。

5)、查看数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.02 sec)

可以看到MySQL服务器中有三个数据库。

6)、使用数据库
mysql> use test
Database changed

7)、查看数据库中的表
mysql> show tables;
Empty set (0.00 sec)

8)、创建表ttt
mysql> create table ttt(a int,b varchar(20));
Query OK, 0 rows affected (0.00 sec)

9)、插入三条数据
mysql> insert into ttt values(1,'aaa');
Query OK, 1 row affected (0.02 sec)

mysql> insert into ttt values(2,'bbb');
Query OK, 1 row affected (0.00 sec)

mysql> insert into ttt values(3,'ccc');
Query OK, 1 row affected (0.00 sec)

10)、查询数据
mysql> select * from ttt;
+------+------+
| a | b |
+------+------+
| 1 | aaa |
| 2 | bbb |
| 3 | ccc |
+------+------+
3 rows in set (0.00 sec)

11)、删除数据
mysql> delete from ttt where a=3;
Query OK, 1 row affected (0.01 sec)

删除后查询操作结果:
mysql> select * from ttt;
+------+------+
| a | b |
+------+------+
| 1 | aaa |
| 2 | bbb |
+------+------+
2 rows in set (0.00 sec)

12)、更新数据
mysql> update ttt set b = 'xxx' where a =2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

查看更新结果:
mysql> select * from ttt;
+------+------+
| a | b |
+------+------+
| 1 | aaa |
| 2 | xxx |
+------+------+
2 rows in set (0.00 sec)

13)、删除表
mysql> drop table ttt;
Query OK, 0 rows affected (0.00 sec)

查看数据库中剩余的表:
mysql> show tables;
Empty set (0.00 sec)

三、更改MySQL数据库root用户的密码

1、使用mysql数据库
mysql> use mysql
Database changed

2、查看mysql数据库中所有的表
mysql>show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| func |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| proc |
| procs_priv |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
17 rows in set (0.00 sec)

3、删除mysql数据库中用户表的所有数据
mysql> delete from user;
Query OK, 3 rows affected (0.00 sec)

4、创建一个root用户,密码为"xiaohui"。
mysql>grant all on *.* to root@'%' identified by 'xiaohui' with grant option;
Query OK, 0 rows affected (0.02 sec)

5、查看user表中的用户
mysql> select User from user;
+------+
| User |
+------+
| root |
+------+
1 row in set (0.00 sec)

6、重启MySQL:更改了MySQL用户后,需要重启MySQL服务器才可以生效。
net stop mysql
MySQL 服务正在停止..
MySQL 服务已成功停止。

net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

7、重新登陆MySQL服务器
mysql -uroot -pxiaohui
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.32-community MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

如果修改密码后net startmysql出现不能启动mysql的1067错误,则可以使用以下办法解决:
使用cmd命令:D:\Appserv\mysql\bin\mysqladmin -uroot -p shutdown,然后输入密码,再net start mysql 就没有这个错误提示了!

四、数据库的创建与删除

1、创建数据库testdb
mysql> create database testdb;
Query OK, 1 row affected (0.02 sec)

2、使用数据库testdb
mysql> use testdb;
Database changed

3、删除数据库testdb
mysql> drop database testdb;
Query OK, 0 rows affected (0.00 sec)

4、退出登陆
mysql>exit
Bye

C:\Documents and Settings\Administrator>

五、操作数据库数据的一般步骤

1、启动MySQL服务器
2、登陆数据库服务器
3、使用某个要操作的数据库
4、操作该数据库中的表,可执行增删改查各种操作。
5、退出登陆。


详细出处参考:http://www.jb51.net/article/29396.htm

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 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months 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)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values ​​to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

The difference between oracle database and mysql The difference between oracle database and mysql May 10, 2024 am 01:54 AM

Oracle database and MySQL are both databases based on the relational model, but Oracle is superior in terms of compatibility, scalability, data types and security; while MySQL focuses on speed and flexibility and is more suitable for small to medium-sized data sets. . ① Oracle provides a wide range of data types, ② provides advanced security features, ③ is suitable for enterprise-level applications; ① MySQL supports NoSQL data types, ② has fewer security measures, and ③ is suitable for small to medium-sized applications.

See all articles