博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Centos7源码安装mariadb
阅读量:5876 次
发布时间:2019-06-19

本文共 2612 字,大约阅读时间需要 8 分钟。

1,下载并解压安装包到指定目录

下载地址:

可根据需要下载不同的软件版本

tar xf  mariadb-5.5.31-linux-x86_64.tar.gz   -C /usr/local/

2,创建mysql组和用户

groupadd -r -g 306 mysqluseradd -r -g 306 -u 306 –d /data/mysql mysql

3,进入到解压目录中,并设置目录的所有者和所属组

cd /usr/localln -sv mariadb-5.5.31-linux-x86_64 mysqlchown -R root:mysql /usr/local/mysql/

4,准备配置文件

mkdir /etc/mysql/ #设置配置文件的安装位置cp /usr/local/mysql/support-files/my-large.cnf /etc/mysql/my.cnf

5,修改配置文件

vim /etc/mysql/my.cnf[mysqld]中添加三个选项:datadir = /data/mysql #库文件的所在位置,该文件夹的所有者和所属组必须是mysqlinnodb_file_per_table = on #数据库中的表分开进行存放 skip_name_resolve = on #禁止主机名解析,建议使用

6,创建数据库文件

cd /usr/local/mysql/./scripts/mysql_install_db --datadir=/data/mysql --user=mysql如果出现如下错误:./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory则需要安装yum -y install  libaio

7,准备服务脚本,并启动服务

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqldchkconfig --add mysqldservice mysqld start

8,设置PATH路径

echo ‘PATH=/user/local/mysql/bin:$PATH’ > /etc/profile.d/mysql

9,安全初始化

service mysqld restart #启动mariadb服务/user/local/mysql/bin/mysql_secure_installationSetting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation.Set root password? [Y/n] y #是否设置root密码New password: Re-enter new password: Password updated successfully!Reloading privilege tables.. ... Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] y #是否移除匿名用户 ... Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] y #是否禁止root用户远程登录 ... Success!By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] y #是否删除test库 - Dropping test database... ... Success! - Removing privileges on test database... ... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] y #是否重新加载权限表,让设置生效 ... Success!Cleaning up...All done!  If you ave completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB

转载于:https://blog.51cto.com/14163901/2401047

你可能感兴趣的文章
CSS颜色代码大全
查看>>
我的友情链接
查看>>
mybatis数据处理的几种方式
查看>>
QStandardItem and QStandardItemModel Class Reference
查看>>
友情链接的作用
查看>>
我的友情链接
查看>>
使用Nginx搭建WEB服务器
查看>>
【oracle唯一主键SYS_GUID()】
查看>>
作业2
查看>>
raid技术-研究感受
查看>>
远程主机探测技术FAQ集 - 扫描篇
查看>>
C++中调用python函数
查看>>
Nomad添加acl认证
查看>>
“TI门外汉”网路知识笔记一 OSI参考模型
查看>>
你不需要jQuery(五)
查看>>
DatanodeDescriptor说明
查看>>
ServlertContext
查看>>
eclipse编辑器生命周期事件监听
查看>>
Python WOL/WakeOnLan/网络唤醒数据包发送工具
查看>>
sizeof(long)
查看>>