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 编译安装的更多相关文章

  1. Linux(centos)下mysql编译安装教程

    Linux下mysql编译安装教程 #查看linux发行版本 cat /etc/issue #查看linux内核版本号 uname -r 本文測试环境centOS6.6 一.Linux下编译安装MyS ...

  2. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  3. Mysql编译安装及优化

    采取编译安装的方法,其好处为:编译安装与平台无关,安装的MySQL目录独立,维护起来方便,而且拥有更好的性能. 环境:CentOS release 6.9 (Final)  x86_64 1)下载my ...

  4. mysql 编译安装

    mysql 编译安装方式:   ```cd /home/oldboy/tools```                创建 目录          if not have   then     mkd ...

  5. CentOS 7 编译安装 Code::Blocks

    CentOS 7 编译安装 Code::Blocks yum install cairo-devel yum install pango-devel yum install atk-devel yum ...

  6. Nginx PHP MySql 编译安装

    以CentOS5.6为平台编译安装.确保系统已经安装gcc/gcc-c++编译器! 1.Nginx-1.0.14 2.PHP-5.3.10 3.MySql-5.1.61 安装相关依赖开发库: auto ...

  7. mysql编译安装(详细)(转载)

    mysql编译安装(详细)   一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake,从 ...

  8. 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 ...

  9. 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装

    系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...

随机推荐

  1. Entity Framework 实践系列 —— 搞好关系 - 单相思(单向一对一,one-to-one)【转】

    原以为躲入代码世界,就可以不用搞关系,哪知“关系无处不在”.写代码多年之后,终于明白“面向对象的关键是搞好对象之间的关系”.而Entity Framework作为ORM中的明日之星,首当其冲的使命就是 ...

  2. struts2 拦截器1

    action invoke前会调用,invoke后会调用 public class FirstInterceptor extends AbstractInterceptor{ @Override pu ...

  3. 关于 width;height

    IE Firefox Chrome Safari window(width|height)   no yes yes document.body document.documentElement 网页 ...

  4. js optimization and performance

    http://www.codeproject.com/Articles/551733/Walkthrough-3aplusUsingplustheplusRequireJSplusOpt http:/ ...

  5. The Glorious Karlutka River =)

    sgu438:http://acm.sgu.ru/problem.php?contest=0&problem=438 题意:有一条东西向流淌的河,宽为 W,河中有 N 块石头,每块石头的坐标( ...

  6. 两种QMultiMap的遍历方法(最好使用只读遍历器)

    留个爪,备查 QMultiMap<QString, QString>& remote_map = my_obj->m_MapVersion; // ccc 这里体现了引用的好 ...

  7. 浅谈云计算之SAN扩展系统设计

    设计背景:不管是公有云还是私有云,为了提供服务的持续性(Business Continuity,BC)和数据的灾难恢复(Disaster Recovery,DR)都不可能只有一个数据中心(Data C ...

  8. 网络流CodeForces. Original 589F:Gourmet and Banquet

    A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet kno ...

  9. Selenium稳定性 Test

    [Test] public void DriverExtension_Wait() { var driver = new FirefoxDriver(); driver.Navigate().GoTo ...

  10. removeTask

    SystemUI中,Home键调出小刷子杀最近任务,整个流程从其RecentsPanelView.java开始: public void handleSwipe(View view) { ... // ...