centos mysql 编译安装
centos mysql 编译安装
1.安装
创建MySQL用户
sudo useradd mysql
下载MySQL的源码包,我们这里使用的时5.5.18
安装依赖
sudo yum -y install cmake gcc-c++ make bison-devel ncurses-devel mysql-devel
防止内置的my.cnf捣乱
sudo mv /etc/my.cnf /etc/my.cnf.bak
解压源码包,
cd /home/xiaohe/tools
tar -zxf mysql-5.5.18.tar.gz
cd mysql-5.5.18
cmake -DCMAKE_INSTALL_PREFIX=/home/xiaohe/mysql -DMYSQL_UNIX_ADDR=/home/xiaohe/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/home/xiaohe/mysql/data
make -j2 && make -j2 install
-j2 的2 指的是cpu核心数,有几个核心就是几
手动创建目录
cd /home/xiaohe/mysql && mkdir etc tmp var log
创建配置文件
vim etc/my.cnf
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /home/xiaohe/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
!include /etc/mysqld.cnf
port = 3306
socket = /home/xiaohe/mysql/mysql.sock
skip-external-locking
log-warnings = 2
log-error = /home/xiaohe/mysql/log/mysql.err
pid-file = /home/xiaohe/mysql/var/mysql.pid
basedir = /home/xiaohe/mysql/
datadir = /home/xiaohe/mysql/data/
log-queries-not-using-indexes
long-query-time = 1
#slow-query-log = 1
#slow-query-log-file= /home/xiaohe/mysql/log/slow.log
pid-file = /home/xiaohe/mysql/var/mysql.pid
tmpdir = /home/xiaohe/mysql/tmp/
slave-load-tmpdir = /home/xiaohe/mysql/tmp/
max_connections = 100
skip-name-resolve
skip-symbolic-links
slave-net-timeout=3
sync_binlog=1
relay_log_recovery=true
key_buffer_size = 16k
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
max_allowed_packet = 1M
table_open_cache = 4
net_buffer_length = 2K
#default_table_type = INNODB
#transaction_isolation = REPEATABLE-READ
innodb_status_file
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_data_home_dir = /home/xiaohe/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_group_home_dir = /home/xiaohe/mysql/data/
innodb_log_file_size = 5M
innodb_log_files_in_group = 2
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 50
server-id = 1
log-bin=mysql-bin
binlog_format=mixed
log-slave-updates
replicate-wild-ignore-table=mysql.%
slave-skip-errors =1062
#read-only
#binlog-ignore-db=mysql
#binlog-do-db=mysql
[mysqldump]
max_allowed_packet = 16M
[mysql]
no-auto-rehash
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
初始化数据库
/home/xiaohe/mysql/scripts/mysql_install_db
完成后启动数据库
/home/xiaohe/mysql/bin/mysqld_safe &
检查一下数据库进程,并登陆一下看看,默认没有密码。
修改mysql密码
mysql
mysql> use mysql;
mysql> UPDATE user SET password=password("123456") WHERE user='root';
mysql> flush privileges;
mysql> exit;
关闭mysql 设置superctl登陆
vim /home/xiaohe/supervisor/conf/supervisord.conf
[program:mysql-3306]
command= /home/xiaohe/mysql-3306/bin/mysqld --defaults-file=/home/xiaohe/mysql-3306/etc/my.cnf
directory=/home/xiaohe/mysql-3306
user=xiaohe
查看状态
/home/xiaohe/superctl status
加载进去
/home/xiaohe/superctl update
授权
mysql> grant select,insert,update,delete on *.* to 'root'@'%' identified by '123456' with grant option;
赋予任何主机访问数据的权限 具体根据实际情况授权,以权限最小化为准
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION
centos mysql 编译安装的更多相关文章
- Linux(centos)下mysql编译安装教程
Linux下mysql编译安装教程 #查看linux发行版本 cat /etc/issue #查看linux内核版本号 uname -r 本文測试环境centOS6.6 一.Linux下编译安装MyS ...
- centos下编译安装lnmp
centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...
- Mysql编译安装及优化
采取编译安装的方法,其好处为:编译安装与平台无关,安装的MySQL目录独立,维护起来方便,而且拥有更好的性能. 环境:CentOS release 6.9 (Final) x86_64 1)下载my ...
- mysql 编译安装
mysql 编译安装方式: ```cd /home/oldboy/tools``` 创建 目录 if not have then mkd ...
- CentOS 7 编译安装 Code::Blocks
CentOS 7 编译安装 Code::Blocks yum install cairo-devel yum install pango-devel yum install atk-devel yum ...
- Nginx PHP MySql 编译安装
以CentOS5.6为平台编译安装.确保系统已经安装gcc/gcc-c++编译器! 1.Nginx-1.0.14 2.PHP-5.3.10 3.MySql-5.1.61 安装相关依赖开发库: auto ...
- mysql编译安装(详细)(转载)
mysql编译安装(详细) 一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake,从 ...
- rpm安装MySQL5.5后配置,在centos5上;mysql编译安装在centos6.5上;
[1] 没有/etc/my.cnf: rpm包安装的MySQL是不会安装/etc/my.cnf文件的:处理:cp /usr/share/mysql/my-huge.cnf /etc/my.cnf [2 ...
- 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装
系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...
随机推荐
- 检测目标程序ELF bit是32还是64
android操作系统在5.0之后加入了对64位程序的支持,同时兼容运行32位的进程 android的进程绝大部分是zygote父进程fork出来的子进程 zygote进程fork出来的进程是32位进 ...
- 如何对 Android 库进行依赖管理?
Android 开发人员为项目选择库的时候,考虑的因素不仅仅是功能.可用性.性能.文档丰富度和技术支持情况.他们还关心库的大小,以及要添加的方法数量.因为项目越大,依赖也越多,要把应用的方法数量控制在 ...
- Psychos in a Line
Codeforces Round #189 (Div. 1) B:http://codeforces.com/problemset/problem/319/B 题意:每一ROUND如果某个人的数字大于 ...
- Qt中连接到同一signal的多个slots的执行顺序问题(4.6以后按连接顺序执行)
起源 前些天忘记在哪儿讨论过这个问题,今天在csdn又看到有网友问这个问题,而其他网友却无一例外的给出了“无序”这个答案. Manual Qt的问题,当manual中有明确文字说明时,我们应该以Qt的 ...
- Android数据存储之文件存储
首先给大家介绍使用文件如何对数据进行存储,Activity提供了openFileOutput()方法可以用于把数据输出到文件中,具体的实现过程与在J2SE环境中保存数据到文件中是一样的. public ...
- 【转】iOS 开发怎么入门?
原文网址:http://www.zhihu.com/question/20264108 iOS 开发怎么入门? 请问有设计模式.内存管理方面的资料吗?最好有除了官方文档之外的其它内容,10 条评论 分 ...
- HDU --- 4006
The kth great number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Oth ...
- Tree2cycle
Problem Description A tree with N nodes and N-1 edges is given. To connect or disconnect one edge, w ...
- HDOJ(HDU) 2520 我是菜鸟,我怕谁(等差数列)
Problem Description lin2144是一只小菜鸟,都是笨鸟先飞,lin2144想来个菜鸟先飞,他从0点出发 一开始的飞行速度为1m/s,每过一个单位时间lin2144的飞行速度比上一 ...
- linux平台MongoDB数据库安装
跟Ruiy哥一起玩转吧; <一,初始化玩转MongoDB> 1,关闭SElinux(Ruiy哥根据经验知红帽的SElinux架设就是个错误,还记得不管啥结构首先要关闭的就是它); 2,设置 ...