解压缩版MySQL环境配置及入门_MySQL
bitsCN.com
解压缩版MySQL环境配置及入门 一、环境配置1、解压 mysql-noinstall-5.1.53-win32.zip,在此我解压到了E:/Language/Java/mysql-5.1.53-win32下。2、在根目录下创建my.ini,内容如下:[WinMySQLAdmin] # 指定mysql服务启动启动的文件Server=E://Language//Java//mysql-5.1.53-win32//bin//mysqld-nt.exe[mysqld]
# 设置mysql的安装目录 basedir=E://Language//Java//mysql-5.1.53-win32# 设置mysql数据库的数据的存放目录,必须是data,或者是//xxx/data datadir=E://Language//Java//mysql-5.1.53-win32//data[client]# 设置mysql客户端的字符集default-character-set=utf8[mysqld] default-character-set=utf8 3、安装mysql服务(1) 配置环境变量在path变量中,添加 E:/Language/Java/mysql-5.1.53-win32/bin; (根据自己的安装目录)(2) 安装mysql服务打开DOS窗口 开始->运行 (快捷键:win+r) 输入cmd输入 mysqld --install mysql 回车,显示服务安装成功 (3) 启动mysql服务右击我的电脑->管理 点击 “服务与应用程序”下的“服务”,右击启动mysql服务或者在DOS窗口输入 net start mysql (4) 进入mysql控制台①ODBC用户登录:进入DOS窗口,输入 mysql,回车,即可连接mysql服务器 ②root用户登录:.输入 mysql –u root –p 解释: mysql -u 用户名 -p 密码, 输入密码,初始值为空,可不用输入 注:不指明用户等启用参数时,默认使用ODBC用户登录,而开发过程,我们一般使用root用户对数据库进行操作。select user(); 命令可显示当前登录用户 • 修改root用户密码: 为了保证数据安全性,为root用户添加密码,步骤如下: 1.use mysql; //选择mysql数据库2.update user set password=password(‘新密码’) where user=‘root’; //更改密码,如admin3.flush privileges; // 刷新系统权限表,更改 才生效提示:在DOS下,按动键盘的上下键,可以在历史命令中,快速切换 4、常用命令•查看所有数据库 show databases;•选择数据库 use mysql;对数据的增、删、改、查都是对于特定数据库而言的,在进行数据操作之前,必须先选定要操作的数据库。•查看数据库下的所有表 show tables;•创建数据库 create database 库名;
新创建的数据库保存在 data目录下。 方便宿舍->实验室 Copy •创建表 create table 表名 (字段设定列表);•执行sql脚本文件,批量操作 source “路径名”+/xxxx.sql; 注意:斜杠的方向 / 而不是 /•设置编码 set charset gbk;MySQL的命令行窗口显示中文,必须将编码设置为gbk,否则乱码!•查看字符集 show variables like 'character%'; 例子:连接MySQL后,在DOS下依次输入(1)create databases helloworld;(2)create table student( id int(10) primary key, number int(20) not null, name varchar(20) not null);(3)source E:/Language/Java/insert_student.sql注:insert_student.sql内容为insert into student values(4,411,'张三');insert into student values(2,222,'李四');insert into student values(3,333,'王五');(4)set charset gbk; (5)select * from student; 5、Navicat for MySQL命令行繁琐,不易记忆Navicat是一个MySQL数据库管理和开发工具,具有极好的图形用户界面。控制台窗口的命令,都可以转换成Navicat的操作。刚接触数据库,建议大家多用命令行操作。加深对SQL语句的理解,为将来数据库课程的学习提供帮助。
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

Guide to Square Root in Java. Here we discuss how Square Root works in Java with example and its code implementation respectively.

Guide to Perfect Number in Java. Here we discuss the Definition, How to check Perfect number in Java?, examples with code implementation.

Guide to Random Number Generator in Java. Here we discuss Functions in Java with examples and two different Generators with ther examples.

Guide to Weka in Java. Here we discuss the Introduction, how to use weka java, the type of platform, and advantages with examples.

Guide to the Armstrong Number in Java. Here we discuss an introduction to Armstrong's number in java along with some of the code.

Guide to Smith Number in Java. Here we discuss the Definition, How to check smith number in Java? example with code implementation.

In this article, we have kept the most asked Java Spring Interview Questions with their detailed answers. So that you can crack the interview.

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is
