1、配置安装源
# 安装dnf install http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el9.rpm -y # 修改配置sed -i 's@http://repo.mysql.com/@http://mirrors.ustc.edu.cn/mysql-repo/@g' /etc/yum.repos.d/mysql-community*.repo
2、安装MySQL
dnf install -y mysql-community-server
3、配置MySQL
if [ ! "$(cat /usr/bin/mysqld_pre_systemd | grep -v ^\# | grep initialize-insecure )" ]; then sed -i "s@--initialize @--initialize-insecure @g" /usr/bin/mysqld_pre_systemdfi
4、修改配置文件
[client]port = 3306socket = /var/lib/mysql/mysql.sockdefault-character-set = utf8mb4 [mysql]prompt="MySQL [\d]> "no-auto-rehash [mysqld]port = 3306socket = /var/lib/mysql/mysql.sockdefault_authentication_plugin = mysql_native_password datadir = /var/lib/mysqlpid-file = /var/lib/mysql/mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 1 init-connect = 'SET NAMES utf8mb4'character-set-server = utf8mb4collation-server = utf8mb4_0900_ai_ci skip-name-resolve#skip-networkingback_log = 300 max_connections = 5295max_connect_errors = 6000open_files_limit = 65535table_open_cache = 1024max_allowed_packet = 500Mbinlog_cache_size = 1Mmax_heap_table_size = 8Mtmp_table_size = 128M read_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 256M thread_cache_size = 64 ft_min_word_len = 4 log_bin = mysql-binbinlog_format = rowbinlog_expire_logs_seconds = 604800 log_error = /var/lib/mysql/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = /var/lib/mysql/mysql-slow.log performance_schema = 0explicit_defaults_for_timestamp lower_case_table_names = 1 skip-external-locking default_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 1024Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120 bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 64Mmyisam_max_sort_file_size = 10G interactive_timeout = 28800wait_timeout = 28800 binlog_rows_query_log_events = 1log_bin_trust_function_creators = 1log_timestamps = SYSTEM sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION#sql_mode = NO_AUTO_VALUE_ON_ZEROinnodb_strict_mode = 0plugin-load=mysql_clone.so [mysqldump]quickmax_allowed_packet = 500M [myisamchk]key_buffer_size = 256Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4M
5、启动MySQL
systemctl enable --now mysqld
6、安全配置
# mysql_secure_installationmysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8mb4'.Securing the MySQL server deployment.Connecting to MySQL using a blank password.The 'validate_password' component is installed on the server.The subsequent steps will run with the existing configurationof the component.Please set the password for root here.New password: #输入密码Re-enter new password: #输入密码Estimated strength of the password: 100Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done!
以上就是AlmaLinux9怎么安装MySQL 8.0.32的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/149088.html
微信扫一扫
支付宝扫一扫