search
HomeDatabaseMysql TutorialMySql免安装版的相关配置

MySql免安装版的相关配置

Jun 07, 2016 pm 03:03 PM
mysqlsundownloadInstallOfficial websiteRelatedConfiguration

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 选项指定管道名。

Statement
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
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

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.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

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.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

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

See all articles

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 Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool