安装mariadb数据库
####
https://mariadb.com/kb/en/mariadb-package-repository-setup-and-usage/
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.3"
yum install MariaDB-server MariaDB-client MariaDB-backup
service mariadb start
mysql_secure_installation
初始化数据库设置
ubuntu安装
参考文档:
https://codeantenna.com/a/kwmybASsO3
https://mariadb.com/kb/en/installing-mariadb-binary-tarballs/
流程:
wget https://mirrors.aliyun.com/mariadb//mariadb-10.3.32/bintar-linux-systemd-x86_64/mariadb-10.3.32-linux-systemd-x86_64.tar.gz
tar xvf mariadb-10.3.32-linux-systemd-x86_64.tar.gz -C /usr/local/
cd /usr/local
mv mariadb-10.3.32-linux-systemd-x86_64/ mysql
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
./bin/mysqld_safe --user=mysql &
mysql 命令行可以直接进入数据库
默认是没有密码的,自己再alter user修改密码。
杀掉进程,创建一个my.cnf配置文件
[client] port=3306 socket = /usr/local/mysql/mysql.sock default-character-set = utf8mb4 [mysqld] server-id = 194207 user = root port = 3306 skip_name_resolve skip-external-locking basedir = /usr/local/mysql datadir = /usr/local/mysql/data tmpdir = /usr/local/mysql socket = /usr/local/mysql/mysql.sock #master-info-repository=TABLE #relay-log-info-repository=TABLE binlog-checksum=CRC32 sync-master-info=1 slave-parallel-threads=2 master-verify-checksum=1 slave-sql-verify-checksum=1 #binlog-rows-query-log-events=1 report-port=3306 init_connect='SET NAMES utf8mb4' character-set-server = utf8mb4 character-set-client-handshake = FALSE collation-server = utf8mb4_general_ci transaction_isolation = READ-COMMITTED slave-skip-errors=1396 skip-slave-start log_slave_updates=1 relay_log_purge=1 relay_log_recovery=1 slave-net-timeout=60 binlog-row-image=full binlog_format = row log-bin = /usr/local/mysql/mysql-bin relay_log=/usr/local/mysql/slave-relay-bin relay_log_index=slave-relay-bin.index max_binlog_size = 512M binlog_cache_size = 16M max_binlog_cache_size=1G expire_logs_days = 7 wait_timeout = 3600 connect_timeout=60 interactive_timeout = 3600 back_log = 512 max_connections = 500 max_user_connections=500 max_connect_errors = 1000 thread_stack = 512K key_buffer_size = 256M sort_buffer_size = 1M join_buffer_size = 1M read_buffer_size = 1M read_rnd_buffer_size = 1M tmp_table_size = 128M max_heap_table_size = 128M open_files_limit = 65535 thread_cache_size = 64 external-locking = FALSE query_cache_size = 0 query_cache_type = 0 max_allowed_packet = 64M lower_case_table_names = 1 slow_query_log = 1 long_query_time = 0.8 slow_query_log_file = /usr/local/mysql/mysql-slow.log #log-error = /usr/local/mysql/mysqld.err innodb_data_home_dir= /usr/local/mysql/data #innodb_data_file_path = ibdata1:1024M:autoextend innodb_buffer_pool_size = 128M innodb_buffer_pool_instances = 4 innodb_log_file_size = 512M innodb_log_buffer_size = 64M sync_binlog = 1 innodb_flush_log_at_trx_commit = 1 innodb_max_dirty_pages_pct = 75 innodb_file_per_table = 1 innodb_purge_threads = 4 innodb_open_files = 65535 innodb_io_capacity =800 innodb_io_capacity_max = 1000 innodb_rollback_on_timeout = 1 innodb_print_all_deadlocks = 1 [mysqldump] quick max_allowed_packet = 64M [mysql] no-auto-rehash default-character-set = utf8mb4
再启动数据库
bin/mysqld --defaults-file=/usr/local/mysql/my.cnf