linux下mysql的源码安装
mysql有多中安装方法,本文只涉及编译安装,对其他方法感兴趣的可以自行百度。
1、首先获取mysql软件安装包,这里用wget下载
[root@localhost ~]# wget http://download.chinaunix.net/down.php?id=38987&ResourceID=7159&site=1
2、解压
[root@localhost ~]# tar zxvf mysql-5.1.62.tar.gz
3、创建相关文件夹并配置
[root@localhost ~]# cd mysql-5.1.62
[root@localhost mysql-5.1.62]# mkdir -p /usr/local/mysql
[root@localhost mysql-5.1.62]# mkdir -p /usr/local/mysql/tmp/
[root@localhost mysql-5.1.62]# ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --localstatedir=/usr/local/mysql/data --enable-assembler --enable-thread-safe-client --with-mysqld-user=mysql --with-big-tables --without-debug --with--pyhread --enable-assembler --with-extra-charsets=complex --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase --with-plugin-PLUGIN --with-mysqld-ldflags=all-static --with-client-ldflags=all-static
配置完成后查看是否有报错,正常配置结果如下
configure: WARNING: unrecognized options: --with--pyhread, --with-plugin-PLUGIN
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
说明:
1.可以通过执行./configure -help命令来详细查看以上各参数的用途。
2.如果编译过程中提示不支持的参数,可使用./configure -help查看该mysql版本是否支持该参数
4、编译并生成mysqld的执行文件
[root@localhost mysql-5.1.62]# make
报错:gcc: all-static: No such file or directory
不支持all-static参数,查看./configure -help发现5.1.62版本的mysql确实没有all-static这个参数
[root@localhost mysql-5.1.62]# ./configure -help |grep "all-static"
[root@localhost mysql-5.1.62]#
去掉all-static重新配置编译
[root@localhost mysql-5.1.62]# ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --localstatedir=/usr/local/mysql/data --enable-assembler --enable-thread-safe-client --with-mysqld-user=mysql --with-big-tables --without-debug --with--pyhread --enable-assembler --with-extra-charsets=complex --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase --with-plugin-PLUGIN
5、安装mysql
[root@localhost mysql-5.1.62]# make install
6、获取配置文件
[root@localhost mysql-5.1.62]# cp support-files/my-small.cnf /etc/my.cnf
7、创建数据库文件
[root@localhost mysql-5.1.62]# mkdir -p /usr/local/mysql/data #建立mysql数据文件目录
[root@localhost mysql-5.1.62]# chown -R mysql.mysql /usr/local/mysql/ #授予mysql用户对目录的权限
[root@localhost mysql-5.1.62]# /usr/local/mysql/bin/mysql_install_db --user=mysql #初始化数据文件,安装mysql数据库文件;执行结果如下:
Installing MySQL system tables...
150525 16:46:45 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
150525 16:46:45 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/local/mysql/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 /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
[root@localhost mysql-5.1.62]#
8、启动mysql
[root@localhost mysql-5.1.62]# /usr/local/mysql/bin/mysqld_safe & #启动mysql
[1] 5907
[root@localhost mysql-5.1.62]# 150525 16:53:53 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
150525 16:53:53 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@localhost mysql-5.1.62]# netstat -lnt|grep 3306 #mysql默认端口3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
[root@localhost mysql-5.1.62]# mysql #mysql登录
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.62 Source distribution
Copyright (c) 2000, 2012, 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.
mysql> quit
Bye
安装完后我们还要查看并删除多余用户
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.62 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All ri
Oracle is a registered trademark of Oracle Corporation and/or
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current
mysql> select user,host from mysql.user;
+------+-----------------------+
| user | host |
+------+-----------------------+
| root | 127.0.0.1 |
| | localhost |
| root | localhost |
| | localhost.localdomain |
| root | localhost.localdomain |
+------+-----------------------+
5 rows in set (0.00 sec)
mysql> drop user ""@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ""@localhost.localdomain
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from mysql.user;
+------+-----------------------+
| user | host |
+------+-----------------------+
| root | 127.0.0.1 |
| root | localhost |
| root | localhost.localdomain |
+------+-----------------------+
3 rows in set (0.00 sec)
mysql>
linux下mysql的源码安装的更多相关文章
- centos下mysql 5源码安装全过程记录
参考:http://blog.csdn.net/mycwq/article/details/24488691 安装cmake,mysql 5.5以后的版本要通过cmake进行编译 在新装的CentOS ...
- linux下无root源码安装软件
先进入源码文件夹下指定安装路径 ./configure --prefix=/public/home/ztu/usr/samtools 编译 make 安装 make install 写入环境变量 vi ...
- linux下获取软件源码包 centos/redhat, debian/ubuntu
linux下获取软件源码包 centos/redhat, debian/ubuntu centos下: 1. yum install yum-utils 主要为了获取yumdownloader 2. ...
- CentOS Linux release 7.3源码安装zabbix
CentOS Linux release 7.3安装zabbix 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 前言: 我去年用用centos6的环境搭建了一下 zabbix3.0 ...
- LinuxMint下的Orionode源码安装
1. Orionode介绍 Eclipse-orion是Eclipse项目下面的一个子项目,orion是一个在在线版的代码编辑环境.其介绍参考http://wiki.eclipse.org/Orion ...
- Windows,linux下编译qt源码(比较简单)
一.linux下静态编译qt源码 1.取到qt源码并解压到文件夹 2.cd到qt目录下 3.使用configure生成makefile ./configure–prefix /opt/qtstatic ...
- 【MySQL】源码安装
操作系统:Red Hat Enterprise Linux Server release 6.5 Mysql安装包:mysql-5.6.4-m7.tar.zip,下载地址:http://pan.bai ...
- Linux下编译Qt源码,一定要下载tar.gz版本,否则会报权限不足
首先下载qt-everywhere-opensource-src-4.8.1源码,下载地址: ftp://ftp.qt-project.org/qt/source/ 在Linux下编译一定要下载qt- ...
- linux下对rpm源码手工打补丁
前言 通常情况rpm包组件管理方式下的linux环境,常用打补丁的方式只有一种:修改spec文件定义的Patch和patch字段,其实spec文件中调用的底层命令还是patch. 因为业务需要要编译 ...
随机推荐
- WPF 程序无法触摸操作?我们一起来找原因和解决方法!
WPF 自诞生以来就带着微软先生的傲慢.微软说 WPF 支持触摸,于是 WPF 就真的支持触摸了.对,我说的是"支持触摸",那种摸上去能点能动的:偶尔还能带点儿多指的炫酷效果.但是 ...
- You're Given a String...
You're given a string of lower-case Latin letters. Your task is to find the length of its longest su ...
- "http://127.0.0.1:4723/wd/hub"的解释
先补充一个内容,就是appium安装时候的环境变量配置,必须要配ANDROID_HOME这个变量,不是“要配置”,是“必须配置”,其他的那些放到系统变量的path里就可以了: # coding: ut ...
- matplotlib ----- 初步
直接看几段代码即可: # 加载模块的方式 import matplotlib.pyplot as plt import numpy as np # 最简单的单线图 x = np.linspace(0, ...
- struts 2整合spring要注意的问题(二)
在 struts2_spring_plugin.xml配置文件里有一个strus.objectFactory.spring.autoWire 属性 默认值为name 也就是说你不想装载.它都会找个 ...
- C#类、方法的访问修饰符
这篇文章主要介绍了C#类的访问修饰符用法,较为详细的分析了C#类的访问修饰符概念与用法,具有一定的参考借鉴价值,需要的朋友可以参考下 本文详细分析了C#类的访问修饰符用法,分享给大家供大家参考.具体用 ...
- 将 PCB 文件转换为可读的文本
将 PCB 文件转换为可读的文本 将元件转成列表. 坐标也放到列表中. 以元件号为排序. 使用 json 格式,并格式,方便对比. 元件网络转成单独文件. 特殊说明生成单独文件.
- 洛谷3195(HNOI2008)玩具装箱
题目:https://www.luogu.org/problemnew/show/P3195 自己做斜率优化的第一道题. 推成斜率优化的样子很重要. 斜率优化的样子就是从 j 中求 i 的话,关系式里 ...
- Mac下docker搭建lnmp环境 + redis + elasticsearch
之前在windows下一直使用vagrant做开发, 团队里面也是各种开发环境,几个人也没有统一环境,各种上线都是人肉,偶尔还会有因为开发.测试.生产环境由于软件版本或者配置不一致产生的问题, 今年准 ...
- xunsearch开发流程(三)
(一).编写项目配置文件 通过创建一个项目文件来创建一个新的项目cd /data/local/xunsearch/sdk/php/apptouch njw.ini文件内容如下 project.name ...