版本:5.6.17
1.将解压后的文件夹放到某个目录下,比如c:\software;
2.在环境变量中新建MYSQL_HOME=C:\software\mysql-5.6.17-winx64
,然后在系统变量Path下添上 %MYSQL_HOME%\bin
;
3.将根目录下my-default.ini拷贝一份,改名为my.ini,并修改以下部分为实际情况:
[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
basedir = C:/software/mysql-5.6.17-winx64
datadir = C:/software/mysql-5.6.17-winx64/data
port = 3306
character-set-server=utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=MyISAM
#*** INNODB Specific options ***
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb
4.命令行下执行mysqld -install
将mysql安装到windows的服务(mysqld -remove
将卸载服务);
如果出现错误:install/remove of the service denied,应该右键选择c:/windows下的cmd.exe,以管理员身份运行。
5.执行net start mysql
启动服务(net stop mysql
将停止服务)。
Tips:
刚安装的mysql的root用户是没有密码的,可以连接mysql后用以下语句设置(密码为123):
mysql> update mysql.user set password=PASSWORD('123') where User='root' ;
mysql> flush privileges ;
如果出现错误:UPDATE command denied to user ''@'localhost' for table 'user'
错误 ,则进入mysql/bin
目录,执行
mysqladmin -uroot password 密码
登录时,命令行下:
mysql -u root -p
在提示下输入密码即可。
时间: 2024-09-15 23:00:21