Centos安装MySQL数据库(注意:源码安装)

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: Centos安装MySQL数据库(注意:源码安装)


安装MySQL压缩包,然后拖到服务器文件

1. 下载MySQL安装包

MYSQL官方网站:点我点我

点击DOWNLOAD

找到 MySQL Community (GPL) Downloads »

点进去之后 点击MySQL Community Server(当然你也可以直接点这个…(:з」∠)

Select Operating System: 选择所需要安装mysql的系统(根据自己的云服务器系统)

下载Linux - Generic (glibc 2.12) (x86, 64-bit), Compressed TAR Archive的安装包(我是Centos)

也可以自己手动下载!!!! 选择 Archives

2. 使用FileZilla Client软件传输MySQL安装包

下载完是个安装包,放到云服务器 home/mysql下(建议使用FileZilla Client软件进行传输,传输较慢根据网速决定,我传输预计18分钟…)

等待传输完成 =-=

云端初始化MySQL

如果Error ---- 注意看我终端[root@20230321-instance ~]路径

1. 创建mysql用户和mysql用户组

[root@20230321-instance ~]# groupadd mysql
[root@20230321-instance ~]# useradd -g mysql mysql (一般不会用,最高用户为root)
[root@20230321-instance ~]# passwd root (直接设置root密码,一般密码就是云服务器密码,也用不到改)
注意一下,密码输入是隐式输入,不会显示,你直接输完然后回车就行
Changing password for user mysql.
New password: 请输入你的密码
Retype new password:请再次输入你的密码
passwd: all authentication tokens updated successfully. --> 出这个就是成功

2. 解压mysql压缩包到/usr/loacl/mysql目录

[root@20230321-instance /]# tar -zxvf home/mysql/mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz

接下来如果出一堆mysql文件,不报错就算成功, 比如:

mysql-5.7.27-linux-glibc2.12-x86_64/bin/myisam_ftdump
mysql-5.7.27-linux-glibc2.12-x86_64/bin/myisamchk
mysql-5.7.27-linux-glibc2.12-x86_64/bin/myisamlog
mysql-5.7.27-linux-glibc2.12-x86_64/bin/myisampack
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_client_test_embedded
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_config_editor
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_embedded
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_install_db
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_plugin
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_secure_installation
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_ssl_rsa_setup
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_tzinfo_to_sql
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_upgrade
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqladmin
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlbinlog
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlcheck
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqldump
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlimport
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlpump
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlshow
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlslap
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqltest_embedded
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqlxtest
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqld-debug
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqld-debug.a
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysql_config
mysql-5.7.27-linux-glibc2.12-x86_64/include/big_endian.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/binary_log_types.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/byte_order_generic.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/byte_order_generic_x86.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/decimal.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/errmsg.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/keycache.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/little_endian.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/m_ctype.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/m_string.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_alloc.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_byteorder.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_command.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_compiler.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_config.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_dbug.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_dir.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_getopt.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_global.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_list.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_sys.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_thread.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_thread_local.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/my_xml.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/client_authentication.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/client_plugin.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/client_plugin.h.pp
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/com_data.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/get_password.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/group_replication_priv.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/innodb_priv.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/mysql_lex_string.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_audit.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_audit.h.pp
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_auth.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_auth.h.pp
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_auth_common.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_ftparser.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_ftparser.h.pp
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_group_replication.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_keyring.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_keyring.h.pp
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_trace.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/plugin_validate_password.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_file.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_idle.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_mdl.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_memory.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_ps.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_socket.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_sp.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_stage.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_statement.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_table.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_thread.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/mysql_transaction.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/psi.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/psi_base.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/psi/psi_memory.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_command.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_locking.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_my_plugin_log.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_my_snprintf.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_mysql_alloc.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_mysql_keyring.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_mysql_password_policy.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_mysql_string.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_parser.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_rpl_transaction_ctx.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_rpl_transaction_write_set.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_rules_table.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_security_context.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_srv_session.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_srv_session_info.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_ssl_wrapper.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_thd_alloc.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_thd_engine_lock.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_thd_wait.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/service_thread_scheduler.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/services.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/services.h.pp
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/thread_pool_priv.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql/thread_type.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql_com.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql_com_server.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql_embed.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql_time.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysql_version.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysqld_ername.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/mysqld_error.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/plugin.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/plugin_audit.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/plugin_ftparser.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/plugin_group_replication.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/plugin_keyring.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/plugin_validate_password.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/sql_common.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/sql_state.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/sslopt-case.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/sslopt-longopts.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/sslopt-vars.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/thr_cond.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/thr_mutex.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/thr_rwlock.h
mysql-5.7.27-linux-glibc2.12-x86_64/include/typelib.h
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqlclient.a
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqlservices.a
mysql-5.7.27-linux-glibc2.12-x86_64/lib/pkgconfig/mysqlclient.pc
mysql-5.7.27-linux-glibc2.12-x86_64/share/aclocal/mysql.m4
mysql-5.7.27-linux-glibc2.12-x86_64/docs/ChangeLog
mysql-5.7.27-linux-glibc2.12-x86_64/docs/INFO_SRC
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqld.a
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/comp_err.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/innochecksum.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/lz4_decompress.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/my_print_defaults.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/myisam_ftdump.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/myisamchk.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/myisamlog.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/myisampack.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql.server.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_config.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_config_editor.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_install_db.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_plugin.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_secure_installation.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_ssl_rsa_setup.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_tzinfo_to_sql.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysql_upgrade.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqladmin.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlbinlog.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlcheck.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqld_multi.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqld_safe.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqldump.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqldumpslow.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlimport.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlman.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlpump.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlshow.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/mysqlslap.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/perror.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/replace.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/resolve_stack_dump.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/resolveip.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man1/zlib_decompress.1
mysql-5.7.27-linux-glibc2.12-x86_64/man/man8/mysqld.8
mysql-5.7.27-linux-glibc2.12-x86_64/COPYING
mysql-5.7.27-linux-glibc2.12-x86_64/README
mysql-5.7.27-linux-glibc2.12-x86_64/bin/innochecksum
mysql-5.7.27-linux-glibc2.12-x86_64/bin/lz4_decompress
mysql-5.7.27-linux-glibc2.12-x86_64/bin/my_print_defaults
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqld
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqld_multi
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqld_safe
mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqldumpslow
mysql-5.7.27-linux-glibc2.12-x86_64/bin/perror
mysql-5.7.27-linux-glibc2.12-x86_64/bin/replace
mysql-5.7.27-linux-glibc2.12-x86_64/bin/resolve_stack_dump
mysql-5.7.27-linux-glibc2.12-x86_64/bin/resolveip
mysql-5.7.27-linux-glibc2.12-x86_64/bin/zlib_decompress
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/char.bin
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/dicrc
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/left-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/matrix.bin
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/pos-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/rewrite.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/right-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/sys.dic
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/unk.dic
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/char.bin
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/dicrc
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/left-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/matrix.bin
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/pos-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/rewrite.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/right-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/sys.dic
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/unk.dic
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/char.bin
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/dicrc
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/left-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/matrix.bin
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/pos-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/rewrite.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/right-id.def
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/sys.dic
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/unk.dic
mysql-5.7.27-linux-glibc2.12-x86_64/lib/mecab/etc/mecabrc
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/adt_null.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/auth_socket.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/authentication_ldap_sasl_client.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/connection_control.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/adt_null.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/auth_socket.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/authentication_ldap_sasl_client.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/connection_control.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/group_replication.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/ha_example.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/innodb_engine.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/keyring_file.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/keyring_udf.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libmemcached.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libpluginmecab.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_framework.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_services.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_services_threaded.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_session_detach.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_session_in_thd.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_session_info.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_2_sessions.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_all_col_types.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_cmds_1.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_commit.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_complex.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_errors.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_lock.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_processlist.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_replication.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_shutdown.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_sqlmode.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_stored_procedures_functions.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_sql_views_triggers.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_x_sessions_deinit.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/libtest_x_sessions_init.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/locking_service.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/mypluglib.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/mysql_no_login.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/mysqlx.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/rewrite_example.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/rewriter.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_master.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_slave.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/test_security_context.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/test_udf_services.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/validate_password.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/debug/version_token.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/group_replication.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/ha_example.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/innodb_engine.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/keyring_file.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/keyring_udf.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libmemcached.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libpluginmecab.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_framework.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_services.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_services_threaded.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_session_detach.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_session_in_thd.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_session_info.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_2_sessions.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_all_col_types.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_cmds_1.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_commit.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_complex.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_errors.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_lock.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_processlist.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_replication.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_shutdown.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_sqlmode.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_stored_procedures_functions.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_sql_views_triggers.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_x_sessions_deinit.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/libtest_x_sessions_init.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/locking_service.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/mypluglib.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/mysql_no_login.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/mysqlx.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/rewrite_example.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/rewriter.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/semisync_master.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/semisync_slave.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/test_security_context.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/test_udf_services.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/validate_password.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/plugin/version_token.so
mysql-5.7.27-linux-glibc2.12-x86_64/share/bulgarian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/Index.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/README
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/armscii8.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/ascii.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp1250.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp1251.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp1256.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp1257.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp850.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp852.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/cp866.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/dec8.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/geostd8.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/greek.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/hebrew.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/hp8.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/keybcs2.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/koi8r.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/koi8u.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/latin1.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/latin2.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/latin5.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/latin7.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/macce.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/macroman.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/charsets/swe7.xml
mysql-5.7.27-linux-glibc2.12-x86_64/share/czech/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/danish/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/dictionary.txt
mysql-5.7.27-linux-glibc2.12-x86_64/share/dutch/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/english/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/errmsg-utf8.txt
mysql-5.7.27-linux-glibc2.12-x86_64/share/estonian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/fill_help_tables.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/french/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/german/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/greek/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/hungarian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/innodb_memcached_config.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/italian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/japanese/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/korean/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/mysql_security_commands.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/mysql_sys_schema.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/mysql_system_tables.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/mysql_system_tables_data.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/mysql_test_data_timezone.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/norwegian-ny/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/norwegian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/polish/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/portuguese/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/romanian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/russian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/serbian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/slovak/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/spanish/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/swedish/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/share/ukrainian/errmsg.sys
mysql-5.7.27-linux-glibc2.12-x86_64/support-files/mysql-log-rotate
mysql-5.7.27-linux-glibc2.12-x86_64/support-files/mysqld_multi.server
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqlclient.so
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqlclient.so.20
mysql-5.7.27-linux-glibc2.12-x86_64/lib/libmysqlclient.so.20.3.14
mysql-5.7.27-linux-glibc2.12-x86_64/share/install_rewriter.sql
mysql-5.7.27-linux-glibc2.12-x86_64/share/uninstall_rewriter.sql
mysql-5.7.27-linux-glibc2.12-x86_64/support-files/magic
mysql-5.7.27-linux-glibc2.12-x86_64/support-files/mysql.server
mysql-5.7.27-linux-glibc2.12-x86_64/docs/INFO_BIN
mysql-5.7.27-linux-glibc2.12-x86_64/docs/INFO_SRC

放到/usr/local/mysql 下

[root@20230321-instance /]# mv mysql-5.7.27-linux-glibc2.12-x86_64 /usr/local/mysql/

3. 创建目录

[root@20230321-instance /]# cd /usr/local/mysql
[root@20230321-instance mysql]# mkdir conf  #配置文件目录
[root@20230321-instance mysql]# mkdir data  #配置文件目录
[root@20230321-instance mysql]# mkdir ibdata  #配置文件目录
[root@20230321-instance mysql]# mkdir redolog  #redolog文件目录
[root@20230321-instance mysql]# mkdir -p mysqllog/logfile   #redolog文件目录
[root@20230321-instance mysql]# mkdir -p mysqllog/relaylog   #relaylog文件目录
[root@20230321-instance mysql]# mkdir -p mysqllog/binlog   #binlog文件目录

4. 创建my.cnf配置文件

[root@20230321-instance mysql]# vi /usr/local/mysql/conf/my.cnf
配置文件如下↓
----------------------------------------------------------------------------------------
[mysqld]
server-id=134
port=13306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
character-set-server=utf8mb4
max_connections = 1500
binlog_format=row
log-bin=/usr/local/mysql/mysqllog/binlog
slow_query_log_file=/usr/local/mysql/mysqllog/logfile/slow-query.log
log-error=/usr/local/mysql/mysqllog/logfile/mysql-err.log
relay-log-index=/usr/local/mysql/mysqllog/relaylog/slave-relay-bin.index
relay-log=/usr/local/mysql/mysqllog/relaylog/relaylog-binlog
gtid_mode=ON
enforce_gtid_consistency = ON
event_scheduler=1

5. 更改目录权限

[root@20230321-instance bin]# chown -R root:root /usr/local/mysql

6. 初始化数据库

注意注意!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

执行下面代码行命令前…

请先确定好bin文件是哪个bin文件…

不然下载会报↓

注意: 下面这个是错误示范

[root@20230321-instance bin]# ./mysqld --initialize --user=root --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
这是输入后的报错: -bash: ./mysqld: No such file or directory

下面这个操作才是正确的 👇

[root@20230321-instance /]# cd usr/local/mysql/mysql-5.7.27-linux-glibc2.12-x86_64/bin/
------------------------------------------------------------------------------------------------------------------------------------
无提示错误可以直接往下看(虚线下面)
敲完上面命令如果提示(错误): ./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
1. 这个错误提示意味着在运行 mysqld 命令时,系统无法找到 libaio.so.1 共享库文件。
2.libaio.so.1 文件是 Linux 系统中用于异步 I/O 操作的共享库文件之一。这个库文件通常由多个应用程序使用,因此将其安装在系统范围内可以确保其他应用程序也能够使用它。
3.解决方案:安装 libaio 库
那就下载一个libaio库: sudo yum install libaio
------------------------------------------------------------------------------------------------------------------------------------
下载完毕 libaio后, 继续输入下面的命令
[root@20230321-instance bin]# ./mysqld --initialize --user=root --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

7. 启动数据–mysql用户执行

[root@20230321-instance ~]# /usr/local/mysql/mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqld_safe --defaults-file=/usr/local/mysql/conf/my.cnf --user=root &

8. 修改初始化密码–mysql用户执行

不想改可以不改
 [root@20230321-instance ~]# mysql -h 127.0.0.1 -uroot -P13306 -S /usr/local/mysql/mysql.sock -p
 输入密码:【初始化密码在初始化数据库时,最后一行:2022-05-08T08:52:11.257229Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7s4vui&_Ew#q】
 mysql> alter user 'root'@'localhost' identified by 'mysql';   #修改密码为:mysql

9. 重新登录数据

[root@20230321-instance ~]# mysql -h 127.0.0.1 -uroot -P13306 -S /usr/local/mysql8/mysql.sock -pmysql

10. 至此, MySQL已经安装完毕

如果有报错的话,希望大家可以在评论区说出
欢迎一起讨论错误和bug问题

本套代码摘抄 + 改编自 - https://blog.csdn.net/kande0707/article/details/124651206

感谢无私奉献13年的 kande0707 (:з」∠)

有些细节已标注


————————————————

版权声明:本文为CSDN博主「kande0707」的同人二创文章()

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
1月前
|
SQL 存储 Linux
从配置源到数据库初始化一步步教你在CentOS 7.9上安装SQL Server 2019
【11月更文挑战第16天】本文介绍了在 CentOS 7.9 上安装 SQL Server 2019 的详细步骤,包括配置系统源、安装 SQL Server 2019 软件包以及数据库初始化,确保 SQL Server 正常运行。
|
1月前
|
SQL 存储 Linux
从配置源到数据库初始化一步步教你在CentOS 7.9上安装SQL Server 2019
【11月更文挑战第8天】本文介绍了在 CentOS 7.9 上安装 SQL Server 2019 的详细步骤,包括系统准备、配置安装源、安装 SQL Server 软件包、运行安装程序、初始化数据库以及配置远程连接。通过这些步骤,您可以顺利地在 CentOS 系统上部署和使用 SQL Server 2019。
|
1月前
|
SQL 存储 Linux
从配置源到数据库初始化一步步教你在CentOS 7.9上安装SQL Server 2019
【11月更文挑战第7天】本文介绍了在 CentOS 7.9 上安装 SQL Server 2019 的详细步骤,包括系统要求检查与准备、配置安装源、安装 SQL Server 2019、配置 SQL Server 以及数据库初始化(可选)。通过这些步骤,你可以成功安装并初步配置 SQL Server 2019,进行简单的数据库操作。
|
1月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。通过具体案例,读者可以了解如何准备环境、下载源码、编译安装、配置服务及登录 MySQL。编译源码安装虽然复杂,但提供了更高的定制性和灵活性,适用于需要高度定制的场景。
116 3
|
1月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。
本文介绍了在 CentOS 7 中通过编译源码安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。内容涵盖准备工作、下载源码、编译安装、配置服务、登录设置及实践心得,帮助读者根据需求选择最适合的安装方法。
96 2
|
1月前
|
存储 安全 Linux
VMware安装CentOS7
【11月更文挑战第11天】本文详细介绍了在 VMware 中安装 CentOS 7 的步骤,包括准备工作、创建虚拟机、配置虚拟机硬件和安装 CentOS 7。具体步骤涵盖下载 CentOS 7 镜像文件、安装 VMware 软件、创建和配置虚拟机硬件、启动虚拟机并进行安装设置,最终完成 CentOS 7 的安装。在安装过程中,需注意合理设置磁盘分区、软件选择和网络配置,以确保系统的性能和功能满足需求。
220 0
|
3天前
|
存储 Oracle 关系型数据库
数据库传奇:MySQL创世之父的两千金My、Maria
《数据库传奇:MySQL创世之父的两千金My、Maria》介绍了MySQL的发展历程及其分支MariaDB。MySQL由Michael Widenius等人于1994年创建,现归Oracle所有,广泛应用于阿里巴巴、腾讯等企业。2009年,Widenius因担心Oracle收购影响MySQL的开源性,创建了MariaDB,提供额外功能和改进。维基百科、Google等已逐步替换为MariaDB,以确保更好的性能和社区支持。掌握MariaDB作为备用方案,对未来发展至关重要。
13 3
|
3天前
|
安全 关系型数据库 MySQL
MySQL崩溃保险箱:探秘Redo/Undo日志确保数据库安全无忧!
《MySQL崩溃保险箱:探秘Redo/Undo日志确保数据库安全无忧!》介绍了MySQL中的三种关键日志:二进制日志(Binary Log)、重做日志(Redo Log)和撤销日志(Undo Log)。这些日志确保了数据库的ACID特性,即原子性、一致性、隔离性和持久性。Redo Log记录数据页的物理修改,保证事务持久性;Undo Log记录事务的逆操作,支持回滚和多版本并发控制(MVCC)。文章还详细对比了InnoDB和MyISAM存储引擎在事务支持、锁定机制、并发性等方面的差异,强调了InnoDB在高并发和事务处理中的优势。通过这些机制,MySQL能够在事务执行、崩溃和恢复过程中保持
20 3
|
3天前
|
SQL 关系型数据库 MySQL
数据库灾难应对:MySQL误删除数据的救赎之道,技巧get起来!之binlog
《数据库灾难应对:MySQL误删除数据的救赎之道,技巧get起来!之binlog》介绍了如何利用MySQL的二进制日志(Binlog)恢复误删除的数据。主要内容包括: 1. **启用二进制日志**:在`my.cnf`中配置`log-bin`并重启MySQL服务。 2. **查看二进制日志文件**:使用`SHOW VARIABLES LIKE 'log_%';`和`SHOW MASTER STATUS;`命令获取当前日志文件及位置。 3. **创建数据备份**:确保在恢复前已有备份,以防意外。 4. **导出二进制日志为SQL语句**:使用`mysqlbinlog`
25 2
|
17天前
|
关系型数据库 MySQL 数据库
Python处理数据库:MySQL与SQLite详解 | python小知识
本文详细介绍了如何使用Python操作MySQL和SQLite数据库,包括安装必要的库、连接数据库、执行增删改查等基本操作,适合初学者快速上手。
120 15