欢迎投稿

今日深度:

mariadb linux二进制tar包安装,mariadbtar

mariadb linux二进制tar包安装,mariadbtar


下载

下载 地址为:https://downloads.mariadb.org/

解压

释放安装包 假设安装位置是/usr/local/mariadb 包名为:mariadb-10.1.19-linux-x86_64.tar.gz
tar -xvzf mariadb-10.1.19-linux-x86_64.tar.gz
mv mariadb-10.1.19-linux-x86_64 /usr/local/mariadb/
cd /usr/local/mariadb

相关配置

备份原有mysql配置: mv /etc/my.cnf /etc/my.cnf.bak
复制配置文件: cp support-files/my-huge.cnf /etc/my.cnf
编辑配置文件: vim /etc/my.cnf 在[mysqld]块中添加basedir全局目录将默认的数据目录,日志目录,pid文件都放置在basedir目录下,配置如下:
basedir = /usr/local/soft/mariadb/mariadb-10.2.9-linux-x86_64
skip_name_resolve = ON
innodb_file_per_table = ON

创建用户设置权限

初次安装,要创建mysql用户和组,并给当前目录赋予权限:
groupadd mysql
useradd -r -g mysql -s /sbin/nologin mysql
cd /usr/local/soft/mariadb/mariadb-10.2.9-linux-x86_64/
chown -R mysql .
chgrp -R mysql .
chown mysql.mysql -R data
然后执行初始化安装:

./scripts/mysql_install_db --user=mysql 

这里是个大坑,一定注意不能写成 scripts/mysql_install_db –user=mysql 一定要./scripts/mysql_install_db –user=mysql
调整权限:
chown -R root .
chown -R mysql data/

启动脚本

/usr/local/soft/mariadb/mariadb-10.2.9-linux-x86_64/bin/mysqld_safe –user=mysql &
添加mysql到系统服务目录: cp /usr/local/soft/mariadb/mariadb-10.2.9-linux-x86_64/support-files/mysql.server /etc/init.d/mysqld
如果是之前安装过mysql,那么现在就已经启动了,第一次安装需要手动启动服务: /etc/init.d/mysqld start
添加mysqld到系统服务,随系统一起启动: chkconfig mysqld on
查看mysql服务运行状态: systemctl status mysqld.service

设置数据库允许远程链接:

mysql -u root -proot 
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION; 
操作完后切记执行以下命令刷新权限 
FLUSH PRIVILEGES 

出现错误
[root@testserver mariadb-10.2.10]# ./scripts/mysql_install_db –user=mysql
./scripts/mysql_install_db: ./bin/my_print_defaults: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Neither host 'testserver' nor 'localhost' could be looked up with
'./bin/resolveip'
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

是因为下载的包是32位的 而系统是64位的

www.htsjk.Com true http://www.htsjk.com/mariadb/35196.html NewsArticle mariadb linux二进制tar包安装,mariadbtar 下载 下载 地址为:https://downloads.mariadb.org/ 解压 释放安装包 假设安装位置是/usr/local/mariadb 包名为:mariadb-10.1.19-linux-x86_64.tar.gz tar -xvzf mariadb-10.1.1...
相关文章
    暂无相关文章
评论暂时关闭