[置顶] linux 解压版安装
1:下载mysql解压版包去官网下载www.mysq.com 下载。下载linux通用版本就好了
2、基本配置
首先,我们准备好Linux环境,我们使用CentOS 5.8进行试验安装。第一步,我们需要将下载好的MySQL压缩版通过FTP/SFTP上传到Linux服务器上。
--创建目录
[root@bspdev ~]# cd /
[root@bspdev /]# mkdir mysql
[root@bspdev /]# ls -l | grep mysql
drwxr-xr-x 2 root root 4096 Jul 1 03:56 mysql
使用FTP/SFTP软件,将压缩包(mysql-5.5.25-linux2.6-i686.tar.gz)上传到指定目录,并且解压。
[root@bspdev /]# cd mysql
[root@bspdev mysql]# ls -l
total 175376
-rw-r--r-- 1 root root 179403866 Jul 1 03:57 mysql-5.5.25-linux2.6-i686.tar.gz
[root@bspdev mysql]#tar -vxf mysql-5.5.25-linux2.6-i686.tar.gz
mysql-5.5.25-linux2.6-i686/include/my_config.h
mysql-5.5.25-linux2.6-i686/include/keycache.h
mysql-5.5.25-linux2.6-i686/include/m_string.h
mysql-5.5.25-linux2.6-i686/include/mysql_version.h
mysql-5.5.25-linux2.6-i686/include/my_alloc.h
(篇幅原因,省略……)
[root@bspdev mysql]# ls -l
total 4
drwxr-xr-x 13 root root 4096 Jul 1 04:02 mysql-5.5.25-linux2.6-i686
打开目录,可以发现压缩版解压之后,所有的配置文件和执行程序目录。
[root@bspdev mysql-5.5.25-linux2.6-i686]# ls -l
total 76
drwxr-xr-x 2 root root 4096 Jul 1 04:01 bin
-rw-r--r-- 1 7161 wheel 17987 May 15 15:46 COPYING
drwxr-xr-x 4 root root 4096 Jul 1 04:02 data
drwxr-xr-x 2 root root 4096 Jul 1 04:01 docs
drwxr-xr-x 3 root root 4096 Jul 1 04:00 include
-rw-r--r-- 1 7161 wheel 7604 May 15 15:46 INSTALL-BINARY
drwxr-xr-x 3 root root 4096 Jul 1 04:02 lib
drwxr-xr-x 4 root root 4096 Jul 1 04:00 man
drwxr-xr-x 10 root root 4096 Jul 1 04:02 mysql-test
-rw-r--r-- 1 7161 wheel 2552 May 15 15:46 README
drwxr-xr-x 2 root root 4096 Jul 1 04:01 scripts
drwxr-xr-x 27 root root 4096 Jul 1 04:02 share
drwxr-xr-x 4 root root 4096 Jul 1 04:01 sql-bench
drwxr-xr-x 2 root root 4096 Jul 1 04:01 support-files
[root@bspdev mysql-5.5.25-linux2.6-i686]# pwd
/mysql/mysql-5.5.25-linux2.6-i686
注意,无论是Windows版还是Linux版,MySQL在运行启动的时候,都需要一个基础配置文件。不同的操作系统拓展名称不一样,大都是my.ini/my.cnf等等。
在目录的support-files中,我们可以找到MySQL提供了一套默认模板,用于配置不同规模的MySQL数据库。
[root@bspdev mysql-5.5.25-linux2.6-i686]# cd support-files/
[root@bspdev support-files]# ls -l
total 96
-rwxr-xr-x 1 7161 wheel 1153 May 15 16:46 binary-configure
-rwxr-xr-x 1 7161 wheel 4528 May 15 16:46 config.huge.ini
-rwxr-xr-x 1 7161 wheel 2382 May 15 16:46 config.medium.ini
-rwxr-xr-x 1 7161 wheel 1626 May 15 16:46 config.small.ini
-rw-r--r-- 1 7161 wheel 773 May 15 15:46 magic
-rw-r--r-- 1 7161 wheel 4691 May 15 16:46 my-huge.cnf
-rw-r--r-- 1 7161 wheel 19759 May 15 16:46 my-innodb-heavy-4G.cnf
-rw-r--r-- 1 7161 wheel 4665 May 15 16:46 my-large.cnf
-rw-r--r-- 1 7161 wheel 4676 May 15 16:46 my-medium.cnf
-rw-r--r-- 1 7161 wheel 2840 May 15 16:46 my-small.cnf
-rwxr-xr-x 1 7161 wheel 1061 May 15 16:46 mysqld_multi.server
-rwxr-xr-x 1 7161 wheel 839 May 15 16:46 mysql-log-rotate
-rwxr-xr-x 1 7161 wheel 10650 May 15 16:46 mysql.server
-rwxr-xr-x 1 7161 wheel 1326 May 15 16:46 ndb-config-2-node.ini
--拷贝模板到指定目录指定名称。
[root@bspdev support-files]# cp my-huge.cnf /etc/my.cnf
标红的几个文件,就是针对不同的系统规模,主要是服务器内存大小来预定义的配置文件。My-huge.cnf一般是应对服务器内存在1-2G,而且是专门作为MySQL服务器使用的场景。这点对于目前的生产系统,不是什么大问题。所以,我们使用这个版作为基础模板,复制为/etc/my.cnf。
对MySQL配置文件的目录,不同的操作系统有不同的默认选择。对Windows而言,默认是选择%WINDIR%作为优先搜索目录,找寻文件名称为my.ini的文件。当然,我们在mysqld的启动参数defaults-file中,也可以指定该文件的目录名称。
对Linux环境下,我们就将其放在/etc/my.cnf就可以了。
3、配置文件修改
下面,需要对my.cnf做出简单的修改,使其可以作为启动文件。我们必须添加上MySQL程序文件和数据文件的目录,这样才能够让MySQLd服务器在启动后可以找到相应的路径。
[root@bspdev etc]# su - mysql
[mysql@bspdev ~]$ vi /etc/my.cnf
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# The MySQL server
[mysqld]
basedir=/mysql/mysql-5.5.25-linux2.6-i686
datadir=/mysql/mysql-5.5.25-linux2.6-i686/data
注意,basedir和datadir是通常需要设置的内容。如果没有设置,MySQL会根据操作系统的不同,在默认目录上进行寻找,引起错误。
5、初始化数据库
对Linux版本的压缩版,我们需要手工的创建数据库。在Windows版本中,很多时候是不需要进行这个步骤的。创建的方法也比较简单,就是运行相应的脚本程序。
--在程序目录中。
[mysql@bspdev mysql-5.5.25-linux2.6-i686]$ scripts/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/mysql/mysql-5.5.25-linux2.6-i686/bin/mysqladmin -u root password 'new-password'
/mysql/mysql-5.5.25-linux2.6-i686/bin/mysqladmin -u root -h bspdev.localdomain password 'new-password'
Alternatively you can run:
/mysql/mysql-5.5.25-linux2.6-i686/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /mysql/mysql-5.5.25-linux2.6-i686 ; /mysql/mysql-5.5.25-linux2.6-i686/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /mysql/mysql-5.5.25-linux2.6-i686/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /mysql/mysql-5.5.25-linux2.6-i686/scripts/mysqlbug script!
从输出信息,我们可以看到MySQL提供了一些信息,作为下面工作的参考。
6、启动/关闭测试
方法1:service mysql/mysqld start/restart/stop
方法2:相应目录/mysqld_safe 我本地测试是这样的 /data1/software/mysql-5.1.38/scripts/mysqld_safe
[置顶] linux 解压版安装的更多相关文章
- mysql 5.7 64位 解压版安装
64位操作系统最好安装64位的mysql数据库,充分利用内存的寻址能力,对于windows而言,mysql官网只提供了32位的MSI安装程序,因为在windows下安装64位的mysql,选择解压版安 ...
- MySQL解压版安装配置详解
MySQL解压版安装起来比较简单,步骤相对较少.下面我们就来详细介绍一下如何在windows操作系统上安装解压班的MySQL. 1.下载解压版MySQL,地址:http://downloads.mys ...
- MariaDB数据解压版安装(10.0.16)
官网下载地址:https://downloads.mariadb.org/ (自己选择版本下载) 在windows 7 下安装 1.下载到解压版安装文件mariadb-10.0.16-win32 ...
- MySQL5.7.23解压版安装教程
每次找安装教程太麻烦,因此给自己备份一下步骤,方便以后查看.解压版下载地址https://dev.mysql.com/downloads/mysql/,详细图解如下: 1.根据自己需求,选择适合自己的 ...
- mysql 5.7.21 解压版安装配置方法图文教程
引用:https://www.jb51.net/article/140951.htm 1.首先,你要下载MySQL解压版,下载地址,图解: 2.解压安装包,根据自己的喜好选择路径,我选择的路径是C:\ ...
- 高版本mysql8.0解压版安装步骤
解压版安装操作官网下载: mysql-installer-community-8.0.12.0.msi如上操作: http://www.cnblogs.com/elfin/p/9429877.html ...
- MySQL5.7.21解压版安装详细教程
由于本人经常装系统,每次装完系统之后都要重新安装一些软件,安装软件的时候又要上网查找安装的教程,比较麻烦,所以自己整理了MySQL5.7.21解压版的安装方法,以便查看. 1.首先,你要下载MySQL ...
- MySQL5.7.25解压版安装详细教程
MySQL5.7.25解压版安装详细教程 安装步骤: 1.首先,你要下载MySQL解压版,下载地址:https://www.mysql.com/downloads/,图解: 2.解压安装包,根据自己的 ...
- mysql安装版卸载,解压版安装
卸载:https://blog.csdn.net/cxy_summer/article/details/70142322 解压版安装:https://blog.csdn.net/recky_wiers ...
随机推荐
- android 服务service开启和关闭
startService()方法开启一个服务. 服务只会开启一次,如果服务已经创建,并且没有销毁,多次调用startService方法只会执行onStartCommand方法和onStart方法. 服 ...
- Qt中QString,int,char,QByteArray之间相互转换
http://blog.csdn.net/ymc0329/article/details/7284514 int 转 QString int m=1; QString b; b=QString::n ...
- 如何用CURL并解释JSON
CURL *curl; CURLcode res; struct curl_slist *headers=NULL; // init to NULL is important headers = cu ...
- 【HDOJ】1297 Children’s Queue
递推,最近发现自己做递推的题总是没有思路.下周多练习.对于f(n)可以在第n个位置为男生,此时共有f(n-1)种情况:若在第n个位置为女生,因此第n-1个位置也必须为女生.此时有两种情况,一种情况是在 ...
- 【HDOJ】1262 寻找素数对
典型的二分决策树.而且本身两数和是偶数. #include <stdio.h> #include <string.h> #define MAXNUM 10001 int isP ...
- Error building results for action sayHello in namespace /inteceptor -
原因:不知道如何编译此 struts.xml ,解决方法:导入struts-default文件: <package name="test" namespace=" ...
- [light oj 1328] A Gift from the Setter
1328 - A Gift from the Setter Problem setting is somewhat of a cruel task of throwing something at ...
- ☀【移动】UC极速模式
UC浏览器的部分版本默认是“极速”模式,有何办法能控制UC自动改变其浏览模式? √http://www.zhihu.com/question/20582949 关于UC极速模式下访问网站错乱 √htt ...
- SharePoint 2010 部署 WSP 包
转:http://www.cnblogs.com/myheaven/archive/2011/05/19/2051180.html .net在工程的下面生成了WSP包,在Debug下面.需要放到生产环 ...
- SharePoint Srver 2010 资源汇总
转:http://bbs.winos.cn/thread-93681-1-1.html Microsoft SharePoint Server 2010 是适用于企业和网络的业务协作平台,可以帮助您通 ...