mariadb 压缩包gz安装方式

1.解压安装包
tar -zxvf mariadb-5.5.56-linux-x86_64.tar.gz

2.cd support-files
cp my-small.cnf /etc/my.cnf

2.修改配置文件
[mysqld]
port = 3306
basedir = /home/marridb/mariadb-5.5.56-linux-x86_64
socket = /home/marridb/mariadb-5.5.56-linux-x86_64/mysql.sock
datadir = /home/marridb/mariadb-5.5.56-linux-x86_64/data/marridb
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 64M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 8
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
lower_case_table_names = 1
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake


3.初始化数据库
scripts/mysql_install_db --datadir=/home/marridb/mariadb-5.5.56-linux-x86_64/data --defaults-file=/etc/my.cnf --user=mysql

chown -R root .
cp support-files/mysql.server /etc/init.d/mysqld

chkconfig --add mysqld # 添加至系统服务
chkconfig mysqld on # 设置开机自启动

4.后台运行
cd bin
mysqld_safe --datadir='/home/marridb/mariadb-5.5.56-linux-x86_64/data' &

5.link 文件
ln -s /home/marridb/mariadb-5.5.56-linux-x86_64/mysql.sock /tmp/mysql.sock

6.测试
cd bin
./mysql

7.设置密码
mysqladmin -u root password "root123456"

8.登录并授权
mysql -uroot -p

9.root可从任何IP登录
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypwd' WITH GRANT OPTION;
mysql>FLUSH RIVILEGES;

原文地址:https://www.cnblogs.com/staryea/p/8514144.html