环境:CentOS6.7,minimal安装。

前提条件:安装了编译环境,安装了Apache。

1、下载解压

# wget http://archive.mariadb.org//mariadb-5.5.44/bintar-linux-x86/mariadb-5.5.44-linux-i686.tar.gz
# tar xf mariadb-5.5.44-linux-x86_64.tar.gz -C /usr/local
# cd /usr/local

2、创建数据目录

# mkdir -pv /mydata/data

3、添加用户和组

# useradd -r mysql
#chown -R mysql.mysql /mydata/data

4、添加连接文件

# cd /usr/local
# ln -sv mariadb-5.5.44-linux-x86_64/ mysql

5、更改文件所有者和属组

# cd /usr/local/mysql
# chown -R root.mysql ./*

6、初始化数据库

[root@localhost mysql]# scripts/mysql_install_db --datadir=/mydata/data/ --user=mysql

注意:这里初始化的时候,后面的data目录与my.cnf中的目录必须一直,否则mysqld服务无法启动。

7、设置配置文件

# mkdir /etc/mysql
# cp support-files/my-large.cnf /etc/mysql/my.cnf/
# vim /etc/mysql/my.cnf

8、提供服务脚本

# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod +x /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# service mysqld start

9、测试

# ss -tnl

10、导入二进制执行路径

# vim /etc/profile.d/mysqld.sh
  export PATH=/usr/local/mysql/bin:$PATH
# . /etc/profile.d/mysqld.sh

点赞(115)

评论列表共有 0 条评论

立即
投稿
返回
顶部