189 8069 5689

怎么安装mysqlin 怎么安装mysql80

MySQL 安装与使用方法的具体简介

MySQL 安装与使用 一 什么是 MySQL MySQL (发音为 My Ess Que Ell )是 Tcx 公司()开发的一个多人使用 多执行绪的 SQL 资料库 Server MySQL 主要的目标在快速 稳定和容易使用 MySQL 可在此 取得 二 MySQL 的安装 本文所使用的 MySQL 版本为 mysql tar gz(原始码档) 作业环境为 RedHat +CLE MySQL 预设情况下会安装至 /usr/local 目录下 不过为了日后移除方便 建议将 mysql 独立安装在 /usr/local/mysql 目录 底下为安装 MySQL 的步骤 取得 mysql tar gz 后 于 /usr/local 目录下解开 # cd /usr/local# tar zxvf mysql tar gz# cd mysql 设定 configure 安装选项 选择安装目录 (prefix)以及支援中文 Big 码(with charset=big ) # /configure prefix=/usr/local/mysql # with charset=big 开始编译并安装 # make# make install# scripts/mysql_install_db最后一个步骤是用来产生 MySQL grant tables(会建立一个 mysql 资料库和一些 tables 用来管理使用 MySQL 的授权资讯 也就是使用者有哪些使用资料库的权限) 三 启动 停止 MySQL 要启动 MySQL 的方法 (以本文将 MySQL 安装在 /usr/local/mysql 为例)# /usr/local/mysql/share/mysql server start注意在第一次执行前 须将 mysql server 设成可执行(chmod mysql server) 另外可将这行指令加在 /etc/rc d/rc local 档中 让 MySQL 在开机时自动启动 要停止 MySQL 的方法 # /usr/local/mysql/bin/mysqladmin shutdown如果你为 MySQL Administrator root 帐号(非作业系统的 root)设了密码 要停止 MySQL 则必须像下列这样做 MySQL 会询问你 root 的密码后才会执行 shutdown 的工作 # /usr/local/mysql/bin/mysqladmin u root p shutdown 四 管理与使用 MySQL 简介 在你开始前MySQL 提供了许多工具 (Client Tools)来与 MySQL 资料库 Server 连线 其中最主要的为 mysql 交谈式连线工具与 mysqladmin 公用程式 大部份时候使用者会用 mysql 来和资料库 Server 交谈 底下就以 mysql 连线工具来介绍如何维护与使用 MySQL (以本文安装为例 mysql 工具位于 /usr/local/mysql/bin/mysql) mysql 的使用语法如下 mysql [ u username] [ h host] [ p[password]] [dbname]MySQL 资料库有自己一套使用者帐号与权限管控方法 所以这边所指定的 username 与 password 是 MySQL 的使用者与密码 而不是作业系统的使用者与密码(当然任何使用者都能执行 mysql 然后以 MySQL 的任何帐号进入使用) 在你第一次安装好 MySQL 时 MySQL 的管理帐号为 root 没有设定密码 (非作业系统的 root) 所以在开始前 请先照下列步骤为 root 设好密码 使用 mysql 与 MySQL 资料库 Server 连线 # /usr/local/mysql/bin/mysql u root mysqlReading table information for pletion of table and column namesYou can turn off this feature to get a quicker startup with AWele to the MySQL monitor Commands end with ; or \g Your MySQL connection id is to server version: Type help for help mysql在下了 mysql u root mysql 指令 指定以 root 帐号并开启 mysql 系统资料库 连线至 MySQL 后 会看到一些提示讯息与 mysql 工具的提示符号 以后大部份的工作皆在此提示符号下完成 更改 MySQL系统管理者 root 密码 mysql update user set password=password( 新密码 ) where user= root ;Query OK rows affected ( sec)Rows matched: Changed: Warnings: mysql FLUSH PRIVILEGES;Query OK rows affected ( sec)mysql quitBye注意每个指令后要加上一个分号 ; 才会让 mysql 开始执行 而第二道指令会让已载入记忆体的 mysql 系统资料库更新 最后离开 mysql 工具程式 在更新 root 密码后 日后要与 MySQL 连线的方法为 mysql u root p新密码或者是这样 让 mysql 询问 root 的密码 mysql u root p资料库维护接下来 我们以简单的通讯录资料库作为例子 来介绍如何用 mysql 工具程式来做资料库的维护(新增 授权 资料表维护等) 首先 以 MySQL root 帐号连线后建立一 addbook 资料库 # /usr/local/mysql/bin/mysql u root pEnter password:Wele to the MySQL monitor Commands end with ; or \g Your MySQL connection id is to server version: Type help for help mysql create databae addbook;Query OK row affected ( sec)指定使用 addbook 资料库 并建立一个 friends 资料表 mysql use addbook;Database changedmysql create table friends ( name Char( ) telphone VarChar( ) icq Char( ) address VarChar( ) );Query OK rows affected ( sec)新增几笔资料 并查询看看 mysql insert into friends values( maa 台北县新庄市 );Query OK row affected ( sec)mysql insert into friends (name icq telphone address ) Values ( cxlin 台北县 );Query OK row affected ( sec)mysql select * from friends;+ + + + +| name | telphone | icq | address |+ + + + +| maa | | | 台北县新庄市 || cxlin | | | 台北县 |+ + + + + rows in set ( sec)第二个 insert 指令指定了资料栏位的插入顺序 用法较第一个为弹性 而第一个指令必须依资料表建立结构时的顺序插入资料 更新 删除资料表记录 mysql update friends set address = 桃园县 where name = cxlin ;Query OK row affected ( sec)Rows matched: Changed: Warnings: mysql select * from friends where name = cxlin ;+ + + + +| name | telphone | icq | address |+ + + + +| cxlin | | | 桃园县 |+ + + + + row in set ( sec)mysql delete from friends where name = maa ;Query OK row affected ( sec)mysql select * from friends;+ + + + +| name | telphone | icq | address |+ + + + +| cxlin | | | 桃园县 |+ + + + + row in set ( sec)最后 建好资料库与资料表后 把 addbook 资料库中所有资料表的使用权限(select insert update delete)授权给 maa@localhost(再次提醒 此处的 maa 为 MySQL 的使用者帐号 而非作业系统的 maa 帐号) mysql grant select insert update delete on addbook * to maa@localhost identified by ;Query OK rows affected ( sec)之后 可用 maa 的身份进入 MySQL 存取 addbook 资料库 # /usr/local/mysql/bin/mysql u maa p addbookEnter password:Reading table information for pletion of table and column namesYou can turn off this feature to get a quicker startup with AWele to the MySQL monitor Commands end with ; or \g Your MySQL connection id is to server version: Type help for help mysql status /mysql Ver Distrib for pc linux gnu (i )Connection id: Current database: addbookCurrent user: maa@localhostServer version Protocol version Connection Localhost via UNIX socketUNIX socket /tmp/mysql sockUptime: hours min secThreads: Questions: Slow queries: Opens: Flush tables: Open lishixinzhi/Article/program/MySQL/201311/29503

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了汾阳免费建站欢迎大家使用!

windows下怎么安装mysql

步骤/方法1

打开下载的安装文件,出现如下界面:

2

mysql安装向导启动,点击“next”继续。

3

选择安装类型,有“Typical(默认)”、“Complete(完全)”、“Custom(用户自定义)”三个选项,我们选择“Custom”,有更多的选项,也方便熟悉安装过程。

4

在“MySQL Server(MySQL服务器)”上左键单击,选择“This feature, and all subfeatures, will be installed on local hard drive.”,即“此部分,及下属子部分内容,全部安装在本地硬盘上”。点选“Change...”,手动指定安装目录。

5

确认一下先前的设置,如果有误,按“Back”返回重做。按“Install”开始安装。

6

正在安装中,请稍候,直到出现下面的界面。

7

点击“next”继续,出现如下界面。

8

现在软件安装完成了,出现上面的界面,这里有一个很好的功能,mysql 配置向导,不用向以前一样,自己手动乱七八糟的配置my.ini 了,将“Configure the Mysql Server now”前面的勾打上,点“Finish”结束软件的安装并启动mysql配置向导。

9

点击“Finsh”,出现如下界面,MySQL Server配置向导启动。

10

点击“next”出现如下界面:

选择配置方式,“Detailed Configuration(手动精确配置)”、“Standard Configuration(标准配置)”,我们选择“Detailed Configuration”,方便熟悉配置过程。

选择服务器类型,“Developer Machine(开发测试类,mysql 占用很少资源)”、“Server Machine(服务器类型,mysql占用较多资源)”、“Dedicated MySQL Server Machine(专门的数据库服务器,mysql占用所有可用资源)”,大家根据自己的类型选择了,一般选“Server Machine”,不会太少,也不会占满。

选择mysql数据库的大致用途,“Multifunctional Database(通用多功能型,好)”、“Transactional Database Only(服务器类型,专注于事务处理,一般)”、“Non-Transactional Database Only(非事务处理型,较简单,主要做一些监控、记数用,对MyISAM数据类型的支持仅限于non-transactional),随自己的用途而选择了,我这里选择“Transactional Database Only”,按“Next”继续。

对InnoDB Tablespace进行配置,就是为InnoDB 数据库文件选择一个存储空间,如果修改了,要记住位置,重装的时候要选择一样的地方,否则可能会造成数据库损坏,当然,对数据库做个备份就没问题了,这里不详述。我这里没有修改,使用默认位置,直接按“Next”继续。

选择您的网站的一般mysql 访问量,同时连接的数目,“Decision Support(DSS)/OLAP(20个左右)”、“Online Transaction Processing(OLTP)(500个左右)”、“Manual Setting(手动设置,自己输一个数)”,我这里选“Online Transaction Processing(OLTP)”,自己的服务器,应该够用了,按“Next”继续。

是否启用TCP/IP连接,设定端口,如果不启用,就只能在自己的机器上访问mysql 数据库了,我这里启用,把前面的勾打上,Port Number:3306,在这个页面上,您还可以选择“启用标准模式”Enable Strict Mode),这样MySQL就不会允许细小的语法错误。如果您还是个新手,我建议您取消标准模式以减少麻烦。但熟悉MySQL以后,尽量使用标准模式,因为它可以降低有害数据进入数据库的可能性。还有一个关于防火墙的设置“Add firewall exception ……”需要选中,将MYSQL服务的监听端口加为windows防火墙例外,避免防火墙阻断。按“Next”继续。

注意:如果要用原来数据库的数据,最好能确定原来数据库用的是什么编码,如果这里设置的编码和原来数据库数据的编码不一致,在使用的时候可能会出现乱码。这个比较重要,就是对mysql默认数据库语言编码进行设置,第一个是西文编码,第二个是多字节的通用utf8编码,都不是我们通用的编码,这里选择第三个,然后在Character Set 那里选择或填入“gbk”,当然也可以用“gb2312”,区别就是gbk的字库容量大,包括了gb

如何安装MYSQL

使用yum安装mysql数据库的软件包 [root@xuegod63 ~]# yum -y install mariadb-server mariadb 。

注:  mariadb-server   #MariaDB数据库 mariadb      # MariaDB服务器Linux下客户端 。

注:从centos7系统开始,系统中自带的mysql数据库变成了mariadb-server,mariadb-server和mysql操作上一样。mariadb-server是mysql的一个分支。

启动数据库服务[root@xuegod63 ~]# systemctl start  mariadb  #启动MariaDB服务。[root@xuegod63 ~]# systemctl enable  mariadb  #设置开启自动启动MariaDB服务。

安装完mariadb-server后,运行mysql_secure_installation去除安全隐患,[root@xuegod63 ~]# mysql_secure_installation #进入安全配置导向。

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQLSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current,password for the root user. If you've just installed MySQL, and,you haven't set the root password yet, the password will be blank,,so you should just press enter here.Enter current password for root (enter for none):   #初次运行直接回车,因为root用户没有密码。

OK, successfully used password, moving on,Setting the root password ensures that nobody can log into the MySQL,root user without the proper authorisation.,Set root password? [Y/n] Y #是否设置root用户密码,输入Y。

New password: 123456   #新密码123456,Re-enter new password: 123456,Password updated successfully!Remove anonymous users? [Y/n] Y   #是否删除匿名用户,生产环境建议删除,所以直接回车或Y。

Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] Y  #是否禁止root远程登录,根据自己的需求选择Y/n并回车建议禁止。

Success!By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] Y   #是否删除test数据库,直接回车或Y。


文章标题:怎么安装mysqlin 怎么安装mysql80
分享路径:http://cdxtjz.cn/article/ddcdigj.html

其他资讯