下载二进制的MariaDB

https://downloads.mariadb.org/mariadb/10.2.16/

安装过程

下载&解压

下载到/tools安装到/application

[root@yl tools]# wget http://ftp.hosteurope.de/mirror/archive.mariadb.org//mariadb-10.2.16/bintar-linux-x86_64/mariadb-10.2.16-linux-x86_64.tar.gz

[root@yl application]# tar -zxvf mariadb-10.2.-linux-x86_64.tar.gz

做软连接

[root@yl application]#ln -s  mariadb-10.2.-linux-x86_64 mysql

创建MySQL用户

[root@yl application]#useradd -s /sbin/nologin -M mysql

对data目录进行授权

[root@yl application]#chown -R mysql.mysql /application/mysql/data/
[root@yl application]#ll /application/mysql/data/ -d
drwxr-xr-x mysql mysql Oct : /application/mysql/data/

进入到主目录执行初始化完成安装

[root@yl application]#/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data

检查安装

1、echo $?               ---返回0
2、确认输出中有两个ok
3、确认data目录下生成数据库文件

设置服务启动文件mysqld

# cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld

设置开机启动

[root@yl mysql]# chkconfig --add mysqld
[root@yl mysql]# chkconfig mysqld on

修改启动服务脚本内容--更改软件的存放目录

sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld /application/mysql/bin/mysql_secure_installation
 注意: 同时修改三个文件

复制配置文件并修改

#cp /application/mysql/support-files/my-huge.cnf /etc/my.cnf

添加
[mysqld]
datadir = /application/mysql/data

添加命令到环境变量两种方法:

1)

#echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
source /etc/profile
which mysql

2)

# vim /etc/profile.d/mysql.sh
PATH=/application/mysql/bin:$PATH 让配置生效
# . /etc/profile.d/mysql.sh

启动&验证

启动

[root@yl mysql] # service mysqld restart

[root@yl mysql]# netstat -lntup |grep 3306

设置密码

运行mysql_secure_installation

[root@yl ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here. Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y
... Success! By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] n
... skipping. Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] y
... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB
installation should now be secure. Thanks for using MariaDB!

最新文章

  1. Oracle数据库中序列用法讲解
  2. vs2010编译lua-5.3.2
  3. 程序员书单_sshi框架篇
  4. C# 学习之旅(2)--- 意外的收获
  5. 关于webservice不支持方法重载的解决办法
  6. [Angular 2] Using a Value from the Store in a Reducer
  7. chrome devtools 实用快捷键
  8. eclipse+python+Anaconda ML环境搭建
  9. Apache Storm 1.1.0 发布概览
  10. Bootstrap中的datetimepicker用法,只看一眼就全懂了
  11. Sql 四大排名函数(ROW_NUMBER、RANK、DENSE_RANK、NTILE)简介
  12. jest-babel报错:Requires Babel "^7.0.0-0", but was loaded with "6.26.3"
  13. linux下如何使用gdb调试
  14. mysql 5.5.x zip直接解压版 报1076
  15. python的命令行参数处理
  16. docker-machine create -d generic 运行的波折过程及遇见的问题
  17. 【delphi】delphi操作sqlite3
  18. GIT 恢复已删除的提交
  19. maven仓库介绍 牛人博客
  20. jquery带参数选项卡4

热门文章

  1. Js数组对象的属性值升序排序,并指定数组中的某个对象移动到数组的最前面
  2. Myeclipse-10.7.1版本破解
  3. 4. JSON字符串是如何被解析的?JsonParser了解一下
  4. 人工智能?.netcore一样胜任!
  5. Python爬虫开发与项目实战pdf电子书|网盘链接带提取码直接提取|
  6. AJAX 是什么?
  7. PHP fnmatch() 函数
  8. luogu P3409 值日班长值周班长 exgcd
  9. react-ts模板2.0
  10. 40行Python制作超炫酷动态排序图,有了它高逼格PPT再也不愁!