网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

CentOS6.6下如何编译安装MariaDB-10.0.24

这篇文章主要为大家展示了“CentOS 6.6下如何编译安装MariaDB-10.0.24”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“CentOS 6.6下如何编译安装MariaDB-10.0.24”这篇文章吧。

公司主营业务:成都网站制作、做网站、外贸营销网站建设、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联建站是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联建站推出龙子湖免费做网站回馈大家。

系统环境:CentOS 6.7(Final)
MariaDB端口:3309 (因为本机原先已经装的有MySQL了,不想删除MySQL)

#wget http://mariadb.nethub.com.hk//mariadb-10.0.20/source/mariadb-10.0.20.tar.gz
# wget -O http://mirrors.neusoft.edu.cn/mariadb//mariadb-10.0.24/source/mariadb-10.0.24.tar.gz

建立mariadb用户
# groupadd -r mariadb
# useradd -g mariadb -r -M -s /sbin/nologin mariadb //禁止mariadb用户本地登录

依赖组件
# yum -y install gcc gcc-c++ make cmake ncurses ncurses-devel libxml2 libxml2-devel openssl-devel bison bison-devel
# tar -zxvf mariadb-10.0.24.tar.gz
# cd mariadb-10.0.24
# cmake . -DMYSQL_UNIX_ADDR=/tmp/mariadb.sock -DSYSCONFDIR=/usr/local/mariadb -DMYSQL_TCP_PORT=3309 -DEXTRA_CHARSETS=all -DMYSQL_USER=mariadb -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DMYSQL_DATADIR=/data/mariadb -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STPRAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWIYH_READLINE=1 -DWIYH_SSL=system -DVITH_ZLIB=system -DWITH_LOBWRAP=0 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
# make -j 4 && make install

把MariaDB服务加入系统环境变量:在最后添加下面这一行
# vim /etc/profile  
export PATH=/usr/local/mariadb/bin:$PATH
# source /etc/profile

复制配置文件
# cp /usr/local/mariadb/support-files/my-large.cnf /usr/local/mariadb/my.cnf

初始化数据库
# /usr/local/mariadb/scripts/mysql_install_db --basedir=/usr/local/mariadb --datadir=/data/mariadb --user=mariadb --defaults-file=/usr/local/mariadb/my.cnf

复制服务启动脚本
# cp /usr/local/mariadb/support-files/mysql.server /etc/init.d/mariadb
# vim /etc/init.d/mariadb
找到
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
行,改为:
$bindir/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
即添加了--defaults-file=/usr/local/mariadb/my.cnf
:wq
# chmod +x /etc/init.d/mariadb
# chkconfig mariadb on

配置/usr/local/mariadb/my.cnf
在[mysqld]模块添加下面的几行:
log-error = /usr/local/mariadb/logs/mariadb_error.log
pid-file = /usr/local/mariadb/mariadb.pid
user=mariadb
datadir = /data/mariadb
basedir = /usr/local/mariadb

新增加mysqld_safe块
[mysqld_safe]
log-error = /usr/local/mariadb/logs/mariadb_error.log
pid-file = /usr/local/mariadb/mariadb.pid

启动前修下目录权限
# chown -R mariadb:mariadb /data/mariadb
# chown -R mariadb:mariadb /data/mariadb/.
# chown -R mariadb:mariadb /usr/local/mariadb
# chown -R mariadb:mariadb /usr/local/mariadb/.

启动MariaDB:
# /etc/init.d/mariadb start
注:如果启动失败,查看下/usr/local/mariadb/logs/mariadb_error.log文件看报什么错,修正即可。

设置root的密码
# /usr/local/mariadb/bin/mysqladmin -u root password '123456'

进入MariaDB的shell下
[root@localhost mariadb]# /usr/local/mariadb/bin/mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.24-MariaDB Source distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show engines\G;

*************************** 1. row ***************************
      Engine: InnoDB
    Support: DEFAULT
    Comment: Percona-XtraDB, Supports transactions, row-level locking, and foreign keys
Transactions: YES
          XA: YES
  Savepoints: YES
*************************** 2. row ***************************
      Engine: MRG_MyISAM
    Support: YES
    Comment: Collection of identical MyISAM tables
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 3. row ***************************
      Engine: CSV
    Support: YES
    Comment: CSV storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 4. row ***************************
      Engine: BLACKHOLE
    Support: YES
    Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 5. row ***************************
      Engine: MyISAM
    Support: YES
    Comment: MyISAM storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 6. row ***************************
      Engine: MEMORY
    Support: YES
    Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 7. row ***************************
      Engine: ARCHIVE
    Support: YES
    Comment: Archive storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 8. row ***************************
      Engine: PERFORMANCE_SCHEMA
    Support: YES
    Comment: Performance Schema
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 9. row ***************************
      Engine: FEDERATED
    Support: YES
    Comment: FederatedX pluggable storage engine
Transactions: YES
          XA: NO
  Savepoints: YES
*************************** 10. row ***************************
      Engine: Aria
    Support: YES
    Comment: Crash-safe tables with MyISAM heritage
Transactions: NO
          XA: NO
  Savepoints: NO
10 rows in set (0.00 sec)

ERROR: No query specified

MariaDB [mysql]> use mysql;                           //选择系统数据库mysql  
MariaDB [mysql]> select Host,User,Password from user; //查看所有用户  
MariaDB [mysql]> delete from user where password="";
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY '123456'; //为root添加远程连接权限
MariaDB [mysql]> flush privileges;  
MariaDB [mysql]> select Host,User,Password from user; //确认密码为空的用户是否已全部删除  
MariaDB [mysql]> exit;

设置防火墙,以便局域网内的其它服务器可以访问
# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3309 -j ACCEPT
# /etc/init.d/iptables save
# /etc/init.d/iptables restart

以上是“CentOS 6.6下如何编译安装MariaDB-10.0.24”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!


分享名称:CentOS6.6下如何编译安装MariaDB-10.0.24
本文路径:http://bjjierui.cn/article/jisojd.html

其他资讯