MySQL 安装和基本命令
开发使用的TOMCAT 版本5.0.28 开发使用的MYSQL数据库mysql-5.0.22 MYSQL数据库开发工具Navicat_MySQL JDK1.4
开发使用的TOMCAT 版本5.0.28
开发使用的MYSQL数据库mysql-5.0.22
MYSQL数据库开发工具Navicat_MySQL
JDK1.4
基础工作:
1.配置环境变量 JDK环境变量:JAVA_HOME
TOMCAT环境变量:CATALINA_HOME
MYSQL环境变量:MYSQL_HOME
遇到的问题:
MYSQL安装耗费时间较长
MYSQL基本命令:
安装过程
1、解压缩mysql-noinstall-5.0.37-win32.zip到一个目录,加入解压缩到E:\myserver目录。
2、编写mysql的运行配置文件my.ini
my.ini
-----------------------------
[WinMySQLAdmin]
# 指定mysql服务启动启动的文件
Server=E:\\myserver\\mysql-5.0.37-win32\\bin\\mysqld-nt.exe
[mysqld]
# 设置mysql的安装目录
basedir=E:\\myserver\\mysql-5.0.37-win32
# 设置mysql数据库的数据的存放目录,必须是data,或者是\\xxx\data
datadir=E:\\myserver\\mysql-5.0.37-win32\\data
# 设置mysql服务器的字符集
default-character-set=gbk
[client]
# 设置mysql客户端的字符集
default-character-set=gbk
-----------------------------
3、安装mysql服务
从MS-DOS窗口进入目录E:\myserver\mysql-5.0.37-win32\bin,运行如下命令:
mysqld --install mysql5 --defaults-file= E:\myserver\mysql-5.0.37-win32\my.ini
4、启动mysql数据库
还在上面的命令窗口里面,输入命令:net start mysql5
这样就启动了mysql服务。
5、(本地)登录mysql数据库
还在上面的命令窗口里面,输入命令:mysql -u root -p
回车后提示输入密码。
mysql解压缩版初次安装管理员root的密码为空,因此直接再回车一次就登入mysql数据库了。
如果你不是初次登录mysql,你还拥有网络地址的用户,那么你可以用如下命令登录到mysql服务器,这个mysql服务器也许在远方,也许在本地。这种登录方式叫“远程登录”,,命令如下:
mysql -h 192.168.3.143 -u root -p
mysql -h 192.168.3.143 -u root -pleizhimin
-h是指定登录ip,-u指定用户,-p指定密码,-p后如果什么都不写,那么接下来会提示输入密码,-p后也可以直接写上密码,这样就不再需要输入密码了。
6、操作数据库和表
登录mysql数据库后,就可以执行指定操作数据库,用命令:use 数据库名
指定了操作的数据库对象后,就可以操作数据库中的表了,操作方法当然是SQL命令了,呵呵。
7、更改mysql数据库管理员root的密码
mysql数据库中默认有个mysql数据库,这个是mysql系统的数据库,用来保存数据库用户、权限等等很多信息。要更改密码,就要操作mysql数据库的user表。
现在mysql的root用户密码还为空,很不安全的,假设要更改密码为“leizhimin”。
还在上面的命令窗口里面,执行如下命令:
use mysql;
grant all on *.* to root@'%' identified by 'leizhimin' with grant option;
commit;
这段命令的含义是,添加一个root用户,拥有所有的权限,密码为“leizhimin”,并且这个用户不但可以本地访问,也可以通过网络访问。强调这个原因是mysql系统自带的的那个root用户只能从本地访问,它@字符后面的标识是localhost。具体可以查看mysql数据的uer表看看,这样以来,就有两个root用户了,一个是系统原来的,一个新建的,为了管理的方便,就将mysql自带root删除,保留刚创建的这个root用户,原因是这个用户可以通过网络访问mysql。

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

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Analysis of the basic principles of the MySQL database management system MySQL is a commonly used relational database management system that uses structured query language (SQL) for data storage and management. This article will introduce the basic principles of the MySQL database management system, including database creation, data table design, data addition, deletion, modification, and other operations, and provide specific code examples. 1. Database Creation In MySQL, you first need to create a database instance to store data. The following code can create a file named "my

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

PHP is a back-end programming language widely used in website development. It has powerful database operation functions and is often used to interact with databases such as MySQL. However, due to the complexity of Chinese character encoding, problems often arise when dealing with Chinese garbled characters in the database. This article will introduce the skills and practices of PHP in handling Chinese garbled characters in databases, including common causes of garbled characters, solutions and specific code examples. Common reasons for garbled characters are incorrect database character set settings: the correct character set needs to be selected when creating the database, such as utf8 or u

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.
