本文目录一览:
- 1、怎么配置mysql 64位数据库服务器
- 2、64位win7系统如何安装MySQL
- 3、win7 64位下如何安装配置mysql
- 4、如何在64位WIN7下安装64位的解压版MySQLmysql-5.6.14
怎么配置mysql 64位数据库服务器
设置mysql数据库远程连接:
Windows系统
1、 停止mysql的服务。
2、 进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:\mysql,进入c:\mysql\bin
3、 进入mysql数据库服务器
c:\mysql\binmysql –u root –p hkgt123
4、 选中数据库mysql :use mysql
5、 查询mysql数据库中的用户:
Select host,user,password from mysql;
6、 授权给root用户可以从任何主机使用密码为’hkgt123’登录MYSQL数据库:
64位win7系统如何安装MySQL
1、找到安装包,点击安装包 安装
2、选择Install MySql Product进入安装
3、同意协议,点击Next 进入下一步
4、跳过更新,继续安装,选择next,需要更新的可以更新
5、设置安装路径和数据库存储路径,以及安装的选择,这里选择FUll ,看个人意愿选择安装不同的安装类型
6、查看安装要求,满足所有要求,点击下一步,不满足的需要先安装,否则安装不成功!
7、下面进入正式的安装过程,每个过程等待几十秒钟,然后根据图片上的教程下一步就行了
8、设置端口号和服务器的类型,个人用户建议选择默认的
9、下一步,进入设置默认的密码和新建用户页面,密码不得少于4个字符
10、安装到最好的过程了,按照图片中指示来,直到安装完成
11、安装完成后,在开始菜单中找到MYSQL打开运行即可
win7 64位下如何安装配置mysql
1、 安装:
1先将mysql-noinstall-5.1.66-winx64.zip解压缩到 d:\appspace\mysql
2将其中的data 文件夹移动到d:/appspace/mysqlData 即mysql的 data路径为:d:/appspace/mysqlData/data
3my.ini配置文件有2个可选择的位置:
打开E:\appSpace\mysql \ my-large.ini (如果后面mysql出现1067错误,启动不了的话,可试着用my-huge.ini或其他), 在最后加上如下几行,然后另存为my.ini(C:\Windows).
#--------------------------------------------------------
[mysqld]
basedir=d:/appspace/mysql
datadir=d:/appspace/mysqlData/data
default-character-set=utf8
[WinMySQLAdmin]
Server=d:/appspace/mysql/bin/mysqld.exe
#default-character-set=utf8
[client]
default-character-set=utf8
#--------------------------------------------------------
4可以在mysql中查看设定的字符集(一定要在[mysqld] 中设定utf-8):
mysql show variables like 'character%';
+--------------------------+-----------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | d:\appspace\mysql\share\charsets\ |
+--------------------------+-----------------------------------+
2 配置服务(命令行必须以administrator身份运行)
1)将MySQL 添加到服务中。
在Windows Run中输入cmd,这时上面有提示(cmd.exe),右键单击cmd.exe, 选择Run as administrator,进入路径: d:/appspace/mysql /bin
输入 mysqld --install MySQL --defaults-file="C:\Windows\my.ini"
要指定defaults-file.
命令行中输入services.msc回车,可以看到MySQL已被添加到Services中,
Path to executable中的内容为
d:\appspace\mysql\bin\mysqld --defaults-file=C:\windows\my.ini MySQL
2)启动MySQL
在MySQL Service中点击Start按钮,或者在命令行(Run as administrator)中输入 net start mysql.
如果出现1067错误,启动不了,则重新检查my.ini文件(前面有描述)
3)关闭MySQL
在MySQL Service中点击Stop按钮,或者在命令行(Run as administrator)中输入 net stop mysql.
4)删除mysql服务
mysqld –remove
3 环境变量
将d:\appspace\ mysql\bin添加到Path中。
4 操作
登录数据库:
C:\Users\zhang10mysql -u root -p
Enter password: *** (密码初始值可设置为root或者为空)
进入mysql后,命令后以分号结尾。
显示所有的数据库模式:
mysql show databases;
新建一个数据库模式,指定编码utf-8,否则会出现乱码。
create database md11uft8 character set utf8;
选中此数据库md11utf8:
mysql use md11utf8;
创建一个表:
mysql create table basicinfo (id int primary key auto_increment, name varchar(30) not null, age int not null);
插入数据:
mysql insert into basicinfo(id, name, age) values('1','张三','30');
mysql insert into basicinfo(id, name, age) values('3','李四','25');
查询:
mysql select * from basicinfo;
+----+------+-----+
| id | name | age |
+----+------+-----+
| 1 | | 30 |
| 3 | | 25 |
+----+------+-----+
可看到name中的值没有显示(中文显示不了)。
在MySQL workbench中插入值,查询会正确显示。
但是在命令行中查询显示乱码(DOS不支持UTF8从MYSQL中显示),解决如下:
mysql set names gbk;
修改root的密码:
mysqluse mysql;
mysqlupdate user set Password=password('newpassword') where User='root';
mysqlflush privileges;
如何在64位WIN7下安装64位的解压版MySQLmysql-5.6.14
安装MySQLmysql-5.6.14可以参考如下安装步骤:
1、将解压缩后的文件放到自己想要的地方,并配置环境变量。示例中存放的目录为:F:\mysql\mysql-5.6.14-winx64
2、在环境变量中添加:MYSQL_HOME:F:\mysql\mysql-5.6.14-winx64,在path路径中加入:%MYSQL_HOME%\bin。配置环境变量不是必须的,只是为了能更方便的在命令行中使用mysql的命令行工具。
3、修改ini配置文件
5.6.14的解压缩版里有一个my-default.ini文件,copy一份改名为my.ini放在同级目录下。修改my.ini, my.ini内容如下:
# For advice on how to change settings please see
#
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
loose-default-character-set=utf8
basedir = F:/mysql/mysql-5.6.14-winx64
datadir = F:/mysql/mysql-5.6.14-winx64/data
[client]
loose-default-character-set=utf8
[WinMySQLadmin]
Server=F:/mysql/mysql-5.6.14-winx64/bin/mysqld.exe
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# 设置mysql的安装目录
# 设置mysql数据库的数据存放目录
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
character-set-server=utf8
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
4、安装服务
开始——所有程序——附件——命令提示符,右键以管理员身份运行。 输入命令:
C:\f:
F:\cd F:\mysql\mysql-5.6.14-winx64\bin
F:\mysql\mysql-5.6.14-winx64\binmysqld -install
Service successfully installed.
5、启动服务
F:\mysql\mysql-5.6.14-winx64\bincd\
F:\net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6、配置用户
还在上面的命令窗口里面,输入命令:mysql -u root -p
回车后提示输入密码。
mysql解压缩版初次安装管理员root的密码为空,因此直接再回车一次就登入mysql数据库了。
F:\mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
成功后
输入命令:use mysql;/*使用mysql数据库*/
mysql use mysql
Database changed
输入命令:select host,user,password from user;/* 查看系统的账户信息 */
mysql select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
+-----------+------+----------+
4 rows in set (0.00 sec)
host:代表mysql服务允许哪个IP来的请求。localhost和127.0.0.1指mysql服务所在的主机,即本地。::1是IPV6的IP地址写法,
全称为:0000:0000:0000:0000:0000:0000:0000:0001。现在都是IPV4的网络,可以不用管他。
user:指账户名称。不同的host下账户名称可以相同。
password:密码。
可以看到,默认账户里只支持本地连接,并且账户没有密码。现在的问题明确了,就是要将匿名用户删除,为root用户添加远程访问和密码,再为自己添加个人账户。指令如下:
mysql update user set password=PASSWORD('root') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql grant all on *.* to root@'%' identify by 'root';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by 'root'' at line 1
mysql grant all on *.* to walle@'%' identify by '123456' with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by '123456' with grant option' at line 1
mysql delete from where user='';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'where
user=''' at line 1
mysql select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 127.0.0.1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| ::1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost | | |
+-----------+------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql commit;
Query OK, 0 rows affected (0.00 sec)
mysql flush privileges;
Query OK, 0 rows affected (0.00 sec)