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

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



In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

Navicat itself does not store the database password, and can only retrieve the encrypted password. Solution: 1. Check the password manager; 2. Check Navicat's "Remember Password" function; 3. Reset the database password; 4. Contact the database administrator.

Create a database using Navicat Premium: Connect to the database server and enter the connection parameters. Right-click on the server and select Create Database. Enter the name of the new database and the specified character set and collation. Connect to the new database and create the table in the Object Browser. Right-click on the table and select Insert Data to insert the data.

Navicat for MariaDB cannot view the database password directly because the password is stored in encrypted form. To ensure the database security, there are three ways to reset your password: reset your password through Navicat and set a complex password. View the configuration file (not recommended, high risk). Use system command line tools (not recommended, you need to be proficient in command line tools).

Copying a table in MySQL requires creating new tables, inserting data, setting foreign keys, copying indexes, triggers, stored procedures, and functions. The specific steps include: creating a new table with the same structure. Insert data from the original table into a new table. Set the same foreign key constraint (if the original table has one). Create the same index. Create the same trigger (if the original table has one). Create the same stored procedure or function (if the original table is used).

View the MySQL database with the following command: Connect to the server: mysql -u Username -p Password Run SHOW DATABASES; Command to get all existing databases Select database: USE database name; View table: SHOW TABLES; View table structure: DESCRIBE table name; View data: SELECT * FROM table name;

Copy and paste in MySQL includes the following steps: select the data, copy with Ctrl C (Windows) or Cmd C (Mac); right-click at the target location, select Paste or use Ctrl V (Windows) or Cmd V (Mac); the copied data is inserted into the target location, or replace existing data (depending on whether the data already exists at the target location).
