MySql免安装版的相关配置
1)、去sun的官网下载一个mysql的压缩包,我下载的是mysql-noinstall-5.5.0-m2-win32.zip。 2)、把上面下载的压缩包解压到:D:/Program Files/mysql下面。 3)、在 D:/Program Files/mysql/ 中找 my-large.ini 把它复制成 my.ini。 4)、在 my.ini 中找 [mysqld
1)、去sun的官网下载一个mysql的压缩包,我下载的是mysql-noinstall-5.5.0-m2-win32.zip。
2)、把上面下载的压缩包解压到:D:/Program Files/mysql下面。
3)、在 D:/Program Files/mysql/ 中找 my-large.ini 把它复制成 my.ini。
4)、在 my.ini 中找 [mysqld] ,添加以下语句:
[mysqld]
basedir="D:/Program Files/mysql/"
datadir="D:/Program Files/mysql/data/"
#设置MySQL中文字符集(MySQL正常显示中文)
#配置服务器端,修改my.ini文件,使用中文字符集存储记录,同时用中文排序比较方式。
default-character-set=GBK
default-storage-engine=innodb
default-collation=gbk_chinese_ci
#skip-networking #// 这句会忽略网络登陆
#bind-address=192.168.0.72 #// 如果加上这句 localhost 就用不了 只要改 user 表的 127.0.0.1 为 % 重启服务 就可以远程登陆
5)、#如果要在中文环境的服务器端使用mysql命令行,改变my.ini文件中mysql的默认字符集。
[mysql]
# set character set
default-character-set=gbk
6)、在客户端程序中,设置中文字符集。以Delphi + ADO + MyODBC为例:
procedure InitConn;
var
nRows: Integer;
begin
。。。
//改变当前MySQL连接session的字符集
ADOConnection1.Execute('set character_set_client=''gbk''', nRows);
ADOConnection1.Execute('set character_set_connection=''gbk''', nRows);
ADOConnection1.Execute('set character_set_results=''gbk''', nRows);
。。。
7)、安装 MySQL_Administrator_1.2 绿色版:把 mysql-gui-tools-noinstall-5.0-r14-win32.zip 解压到 D:/Program Files/mysql/Tools
8)、可以尝试手动启动MySql服务器,并用 MySQL_Administrator_1.2 和 console 登陆:
1、手动启动服务:cmd --> D:/Program Files/mysql/bin/mysqld --console
最后看到 mysqld: ready for connections.
Version: '5.5.0-m2-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
表示 MySql 服务已经启动,可以登陆了,这时: 登陆名是 root ,密码为空,IP 地址只能写 localhost 或 127.0.0.1 ,因为现在root 的权限只允许本地登陆,远程登陆不可以,在本机写本机 IP 地址来登陆被 MySql 视为远程登陆,所以是登陆不了的,会报错 1130
2、MySQL_Administrator_1.2 登陆:到 D:/Program Files/mysql/Tools/ 运行 MySQLAdministrator.exe ,填入 localhost或127.0.0.1 3306 root 密码为空 就可以登陆
3、用 console 登陆: cmd --> D:/Program Files/mysql/bin/mysql -u root -p
密码为空,如果要在登陆时就选定数据库可以这样写:D:/Program Files/mysql/bin/mysql -u root -p[密码] [数据库名]
当前情况举例:D:/Program Files/mysql/bin/mysql -u root -p mysql 就是密码是空的,登陆的数据库是 mysql 库
4、修改root的密码、让root可以远程登陆、添加新用户
修改root的密码:在登陆后的 console 中输入
use mysql
update user set Password=PASSWORD('[密码]') where user='root';
让root可以远程登陆:在登陆后的 console 中输入
use mysql
update user set Host='%' where user='root' and Host='127.0.0.1';
创建用户(用户名:gary 密码:123)
insert into mysql.user(Host,User,Password) values("localhost","gary",password("123"));
刷新系统权限表
flush privileges;
授权gary 用户拥有数据库的所有权限
grant all privileges on *.* togary@localhost
修改用户密码:
grant all privileges on *.* togary identified @localhostby '123';
删除用户:
DELETE FROM user WHERE User="gary" and Host="localhost";
修改用户密码:
update mysql.user set password=password('123456') where User="gary" and Host="localhost";
添加新用户,用户名是 gary,密码为空,权限等于root,用户允许远程登陆 :在登陆后的 console 中输入
GRANT ALL PRIVILEGES ON *. *TO'gary'@'%';
如果用户不可以远程登陆:GRANT ALL PRIVILEGES ON *.* TO'gary'@'localhost';
然后用上面的方法修改gary的密码,root 改为 gary
5、手工停止 MySql 服务:cmd -->D:/Program Files/mysql/bin/mysqladmin -u root shutdown
如果MySQL root用户账户有密码,你需要调用命令 D:/Program Files/mysql/bin/mysqladmin -u root -p shutdown 并根据提示输入密码。
注意:修改密码、修改是否远程登陆,添加用户后必须重启MySql服务才生效 !!!!!!!!!!!!!!!!!!!!!!!!!!!
注意: MySQL权限系统中的用户完全独立于Windows下的登录用户。
7、添加 MySql 服务到windows服务中:
1、简易添加方法:cmd --> D:/Program Files/mysql/bin/mysqld --install 这样用默认的 MySQL 为名称添加一个windows服务。这是,该服务的属性写着:D:/Program Files/mysql/bin/mysqld MySQL
2、指定服务名称与指定启动选项文件的添加方法:
D:/Program Files/mysql/bin/mysqld --install mysql --defaults-file=D:/Program Files/mysql/my.ini
用 mysql 为名称来创建windows服务,指定 D:/Program Files/mysql/my.ini 为MySql的启动选项文件
如果在服务安装命令中,在--install选项后面指定的服务名不是默认服务名(MySQL)。则从具有相同服务名的组中读取选项,并从标准选项文件读取选项。
服务器还从标准选项文件的[mysqld]组读取选项。你可以使用[mysqld]组中的选项用于所有MySQL 服务,还可以使用具有相同服务名的组,用于该服务名所对应的服务器。
该命令中,--install选项后面给出了默认服务名(MySQL)。如果未给出--defaults-file选项,该命令可以让服务器从标准选项文件的[mysqld]组中读数。
由于提供了--defaults-file选项,服务器只从命名文件的[mysqld]组读取选项。
注意:添加服务后该服务并未启动。重启电脑服务就会启动,要手动启动与关闭 MySql 服务用以下语句:
启动MySQL服务:net start mysql
停止MySQL服务:net stop mysql
删除MySQL服务: mysqld --remove mysql即可
8、测试MySQL安装
可以通过以下命令测试MySQL服务器是否工作:
C:/>D:/Program Files/mysql/bin/mysqlshow
C:/>D:/Program Files/mysql/bin/mysqlshow -u root mysql
C:/>D:/Program Files/mysql/bin/mysqladmin version status proc
C:/>D:/Program Files/mysql/bin/mysql test
如果mysqld对客户端程序TCP/IP连接的响应较慢,可能是DNS问题。此时,使用--skip-name-resolve选项启动 mysqld,在MySQL授权表的Host列只使用localhost和IP号。
可以通过 --pipe 或 --protocol=PIPE 选项强制 MySQL 客户端使用命名管道连接代替TCP/IP连接,或指定.(阶段)做为主机名。使用 --socket 选项指定管道名。

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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 main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.
