mysql安装配置

1、Windows7下MySQL5.5.20免安装版的配置

(1)、下载mysql-5.5.20-win32.zip,解压到E:\AppCenter,E盘的AppCenter文件夹下就会出现mysql-5.5.25-winx64目录,将其重命名为mysql。 

(2)、配置MYSQL的环境变量

新建系统变量: MYSQL_HOME,值为E:\AppCenter\mysql
在PATH变量的最后面添加: ;%MYSQL_HOME%\bin

(3)、新建文件my.ini,在my.ini文件中加入如下简单配置:(my.ini是保存在与my-large.ini同一个目录下的)(#表示注释) 

复制代码
 1 # The following options will be passed to all MySQL clients
 2 [client]
 3 #password   = your_password
 4 port        = 3306
 5   
 6 [mysql]
 7 #设置mysql客户端的字符集
 8 default-character-set = utf8
 9   
10 # The MySQL server
11 [mysqld]  
12 port        = 3306
13 #设置mysql的安装目录
14 basedir = E:\AppCenter\mysql
15 #设置mysql数据库的数据存放目录,必须是data或者\xxx-data
16 datadir = E:\AppCenter\mysql\data
17 #设置服务器段的字符集
18 character_set_server = utf8
复制代码

(4)、安装mysql为系统服务

用管理员权限运行命令行,执行如下命令:

mysqld --install mysql --defaults-file=E:\AppCenter\mysql\my.ini

(4)、保存后即可用root登进去

1 mysql -uroot -p

回车后会要求输入密码,默认密码为空,直接回车就可以进入mysql的命令行。

(5)、修改root密码

分别执行下面的两条命令(第一个root是密码):

1 update mysql.user set password=password("root") where User="root";
2 flush privileges;

执行的结果如下所示:

1 mysql> update mysql.user set password=password("root") where User="root";
2 Query OK, 3 rows affected (0.00 sec)
3 Rows matched: 3  Changed: 3  Warnings: 0
4 
5 mysql> flush privileges;
6 Query OK, 0 rows affected (0.00 sec)

(6)退出mysql登陆,再次登录输入刚才设计的密码,检验是否能正常使用

复制代码
 1 mysql> exit;
 2 Bye
 3 
 4 E:\AppCenter\mysql\bin>mysql -uroot -p
 5 Enter password: ****
 6 Welcome to the MySQL monitor.  Commands end with ; or \g.
 7 Your MySQL connection id is 4
 8 Server version: 5.5.25 MySQL Community Server (GPL)
 9 
10 Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
11 
12 Oracle is a registered trademark of Oracle Corporation and/or its
13 affiliates. Other names may be trademarks of their respective
14 owners.
15 
16 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
17 
18 mysql> show databases;
19 +--------------------+
20 | Database           |
21 +--------------------+
22 | information_schema |
23 | mysql              |
24 | performance_schema |
25 | test               |
26 +--------------------+
27 4 rows in set (0.00 sec)
28 
29 mysql>
复制代码

 

2、ubuntu下MySQL的安装配置

2.1. 安装mysql-sever

sudo apt-get install mysql-server

2.2. 设置mysql可被远程连接

mysql>grant all privileges on *.* to 'root'@'%' identified by 'mysql' with grant option;
mysql>flush privileges;

用户:root

密码:mysql

2.3. 配置mysql可被用什么地址来连接

配置文件"/etc/mysql/my.cnf"

bind-address=127.0.0.1

其中的“127.0.0.1”是你的ip,只有用这个ip才能连接到你的mysql-server

 

参考链接:http://supportopensource.iteye.com/blog/1415527

posted on   leocook  阅读(282)  评论(0编辑  收藏  举报

编辑推荐:
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
· 对象命名为何需要避免'-er'和'-or'后缀
· SQL Server如何跟踪自动统计信息更新?
· AI与.NET技术实操系列:使用Catalyst进行自然语言处理
阅读排行:
· 官方的 MCP C# SDK:csharp-sdk
· 一款 .NET 开源、功能强大的远程连接管理工具,支持 RDP、VNC、SSH 等多种主流协议!
· 提示词工程师自白:我如何用一个技巧解放自己的生产力
· 一文搞懂MCP协议与Function Call的区别
· 如何不购买域名在云服务器上搭建HTTPS服务

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示