CentOS7安装MySQL8详细教程

2024年 6月 6日 121.3k 0

#查看操作系统版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost ~]# mkdir /soft
#查看安装包版本
[root@localhost ~]# cd /soft/
[root@localhost soft]# ll
total 0
[root@localhost soft]# cd /root/
[root@localhost ~]# ll
total 612468
-rw-------. 1 root root 1335 Jun 4 18:26 anaconda-ks.cfg
-rw-r--r--. 1 root root 627159428 Jun 4 18:38 mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz
 #安装包移动至/soft
[root@localhost ~]# mv mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz /soft/
 #注意安装介质的版本glibc-2.12 && x86-64
[root@localhost ~]# ll
total 4
-rw-------. 1 root root 1335 Jun 4 18:26 anaconda-ks.cfg
[root@localhost ~]# cd /soft/
[root@localhost soft]# ll
total 612464
-rw-r--r--. 1 root root 627159428 Jun 4 18:38 mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz
#解压安装介质
[root@localhost soft]# tar xvf mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz
mysql-8.0.37-linux-glibc2.12-x86_64/bin/
mysql-8.0.37-linux-glibc2.12-x86_64/bin/myisam_ftdump
mysql-8.0.37-linux-glibc2.12-x86_64/bin/myisamchk
mysql-8.0.37-linux-glibc2.12-x86_64/bin/myisamlog
mysql-8.0.37-linux-glibc2.12-x86_64/bin/myisampack
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_config_editor
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_migrate_keyring
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_secure_installation
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_ssl_rsa_setup
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_tzinfo_to_sql
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_upgrade
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqladmin
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqlbinlog
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqlcheck
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqldump
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqlimport
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqlpump
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqlshow
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqlslap
mysql-8.0.37-linux-glibc2.12-x86_64/lib/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/authentication_fido_client.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/authentication_kerberos_client.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/authentication_ldap_sasl_client.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/authentication_oci_client.so
mysql-8.0.37-linux-glibc2.12-x86_64/bin/
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqld-debug
mysql-8.0.37-linux-glibc2.12-x86_64/bin/
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysql_config
mysql-8.0.37-linux-glibc2.12-x86_64/include/
mysql-8.0.37-linux-glibc2.12-x86_64/include/errmsg.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/field_types.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/my_command.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/my_compress.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/my_list.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql/
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql/client_plugin.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql/plugin_auth_common.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql/udf_registration_types.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql_com.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql_time.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysql_version.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysqld_error.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysqlx_ername.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysqlx_error.h
mysql-8.0.37-linux-glibc2.12-x86_64/include/mysqlx_version.h
mysql-8.0.37-linux-glibc2.12-x86_64/lib/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/libmysqlclient.a
mysql-8.0.37-linux-glibc2.12-x86_64/lib/libmysqlservices.a
mysql-8.0.37-linux-glibc2.12-x86_64/lib/pkgconfig/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/pkgconfig/mysqlclient.pc
mysql-8.0.37-linux-glibc2.12-x86_64/share/
mysql-8.0.37-linux-glibc2.12-x86_64/share/aclocal/
mysql-8.0.37-linux-glibc2.12-x86_64/share/aclocal/mysql.m4
mysql-8.0.37-linux-glibc2.12-x86_64/docs/
mysql-8.0.37-linux-glibc2.12-x86_64/docs/INFO_BIN
mysql-8.0.37-linux-glibc2.12-x86_64/docs/INFO_SRC
mysql-8.0.37-linux-glibc2.12-x86_64/man/
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/comp_err.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/ibd2sdi.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/innochecksum.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/lz4_decompress.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/my_print_defaults.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/myisam_ftdump.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/myisamchk.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/myisamlog.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/myisampack.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql.server.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql_config.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql_config_editor.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql_secure_installation.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql_ssl_rsa_setup.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql_tzinfo_to_sql.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysql_upgrade.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqladmin.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlbinlog.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlcheck.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqld_multi.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqld_safe.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqldump.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqldumpslow.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlimport.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlman.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlpump.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlrouter.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlrouter_passwd.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlrouter_plugin_info.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlshow.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/mysqlslap.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/perror.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man1/zlib_decompress.1
mysql-8.0.37-linux-glibc2.12-x86_64/man/man8/
mysql-8.0.37-linux-glibc2.12-x86_64/man/man8/mysqld.8
mysql-8.0.37-linux-glibc2.12-x86_64/LICENSE
mysql-8.0.37-linux-glibc2.12-x86_64/README
mysql-8.0.37-linux-glibc2.12-x86_64/bin/
mysql-8.0.37-linux-glibc2.12-x86_64/bin/ibd2sdi
mysql-8.0.37-linux-glibc2.12-x86_64/bin/innochecksum
mysql-8.0.37-linux-glibc2.12-x86_64/bin/lz4_decompress
mysql-8.0.37-linux-glibc2.12-x86_64/bin/my_print_defaults
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqld
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqld_multi
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqld_safe
mysql-8.0.37-linux-glibc2.12-x86_64/bin/mysqldumpslow
mysql-8.0.37-linux-glibc2.12-x86_64/bin/perror
mysql-8.0.37-linux-glibc2.12-x86_64/bin/zlib_decompress
mysql-8.0.37-linux-glibc2.12-x86_64/lib/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/char.bin
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/dicrc
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/left-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/matrix.bin
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/pos-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/rewrite.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/right-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/sys.dic
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_euc-jp/unk.dic
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/char.bin
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/dicrc
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/left-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/matrix.bin
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/pos-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/rewrite.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/right-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/sys.dic
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_sjis/unk.dic
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/char.bin
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/dicrc
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/left-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/matrix.bin
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/pos-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/rewrite.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/right-id.def
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/sys.dic
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/dic/ipadic_utf-8/unk.dic
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/etc/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/mecab/etc/mecabrc
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/adt_null.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/auth_socket.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_audit_api_message_emit.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_keyring_file.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_log_filter_dragnet.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_log_sink_json.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_log_sink_syseventlog.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_mysqlbackup.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_query_attributes.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_reference_cache.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/component_validate_password.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/connection_control.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/ddl_rewriter.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/adt_null.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/auth_socket.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_audit_api_message_emit.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_keyring_file.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_log_filter_dragnet.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_log_sink_json.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_log_sink_syseventlog.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_mysqlbackup.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_query_attributes.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_reference_cache.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/component_validate_password.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/connection_control.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/ddl_rewriter.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/group_replication.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/ha_example.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/ha_mock.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/innodb_engine.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/keyring_file.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/keyring_udf.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/libmemcached.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/libpluginmecab.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/locking_service.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/mypluglib.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/mysql_clone.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/mysql_no_login.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/rewrite_example.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/rewriter.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_master.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_replica.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_slave.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/semisync_source.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/validate_password.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/debug/version_token.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/group_replication.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/ha_example.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/ha_mock.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/innodb_engine.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/keyring_file.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/keyring_udf.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/libmemcached.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/libpluginmecab.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/locking_service.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/mypluglib.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/mysql_clone.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/mysql_no_login.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/rewrite_example.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/rewriter.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/semisync_master.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/semisync_replica.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/semisync_slave.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/semisync_source.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/validate_password.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/plugin/version_token.so
mysql-8.0.37-linux-glibc2.12-x86_64/share/
mysql-8.0.37-linux-glibc2.12-x86_64/share/bulgarian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/bulgarian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/Index.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/README
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/armscii8.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/ascii.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp1250.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp1251.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp1256.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp1257.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp850.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp852.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/cp866.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/dec8.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/geostd8.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/greek.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/hebrew.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/hp8.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/keybcs2.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/koi8r.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/koi8u.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/latin1.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/latin2.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/latin5.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/latin7.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/macce.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/macroman.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/charsets/swe7.xml
mysql-8.0.37-linux-glibc2.12-x86_64/share/czech/
mysql-8.0.37-linux-glibc2.12-x86_64/share/czech/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/danish/
mysql-8.0.37-linux-glibc2.12-x86_64/share/danish/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/dictionary.txt
mysql-8.0.37-linux-glibc2.12-x86_64/share/dutch/
mysql-8.0.37-linux-glibc2.12-x86_64/share/dutch/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/english/
mysql-8.0.37-linux-glibc2.12-x86_64/share/english/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/estonian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/estonian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/french/
mysql-8.0.37-linux-glibc2.12-x86_64/share/french/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/german/
mysql-8.0.37-linux-glibc2.12-x86_64/share/german/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/greek/
mysql-8.0.37-linux-glibc2.12-x86_64/share/greek/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/hungarian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/hungarian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/innodb_memcached_config.sql
mysql-8.0.37-linux-glibc2.12-x86_64/share/italian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/italian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/japanese/
mysql-8.0.37-linux-glibc2.12-x86_64/share/japanese/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/korean/
mysql-8.0.37-linux-glibc2.12-x86_64/share/korean/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/messages_to_clients.txt
mysql-8.0.37-linux-glibc2.12-x86_64/share/messages_to_error_log.txt
mysql-8.0.37-linux-glibc2.12-x86_64/share/norwegian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/norwegian-ny/
mysql-8.0.37-linux-glibc2.12-x86_64/share/norwegian-ny/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/norwegian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/polish/
mysql-8.0.37-linux-glibc2.12-x86_64/share/polish/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/portuguese/
mysql-8.0.37-linux-glibc2.12-x86_64/share/portuguese/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/romanian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/romanian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/russian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/russian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/serbian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/serbian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/slovak/
mysql-8.0.37-linux-glibc2.12-x86_64/share/slovak/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/spanish/
mysql-8.0.37-linux-glibc2.12-x86_64/share/spanish/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/swedish/
mysql-8.0.37-linux-glibc2.12-x86_64/share/swedish/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/share/ukrainian/
mysql-8.0.37-linux-glibc2.12-x86_64/share/ukrainian/errmsg.sys
mysql-8.0.37-linux-glibc2.12-x86_64/support-files/
mysql-8.0.37-linux-glibc2.12-x86_64/support-files/mysql-log-rotate
mysql-8.0.37-linux-glibc2.12-x86_64/support-files/mysql.server
mysql-8.0.37-linux-glibc2.12-x86_64/support-files/mysqld_multi.server
mysql-8.0.37-linux-glibc2.12-x86_64/lib/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/libmysqlclient.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/libmysqlclient.so.21
mysql-8.0.37-linux-glibc2.12-x86_64/lib/libmysqlclient.so.21.2.37
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/burmesedict.dict
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/char.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/cjdict.dict
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/de.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/el.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/en.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/en_US.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/en_US_POSIX.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/es.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/fi.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/fr.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/it.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/ja.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/khmerdict.dict
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/ko.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/laodict.dict
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_cj.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_loose.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_loose_cj.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_loose_phrase_cj.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_normal.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_normal_cj.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_normal_phrase_cj.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/line_phrase_cj.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/pt.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/res_index.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/root.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/ru.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/sent.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/sent_el.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/sv.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/thaidict.dict
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/title.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/word.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/word_POSIX.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/word_fi_sv.brk
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/zh.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/brkitr/zh_Hant.res
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/cnvalias.icu
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/uemoji.icu
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/ulayout.icu
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/icudt73l/unames.icu
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libcom_err.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libcom_err.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libcom_err.so.3.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libcrypto.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libcrypto.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libfido2.so.1
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libfido2.so.1.13.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libgssapi_krb5.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libgssapi_krb5.so.2
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libgssapi_krb5.so.2.2
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libk5crypto.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libk5crypto.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libk5crypto.so.3.1
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libkrb5.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libkrb5.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libkrb5.so.3.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libkrb5support.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libkrb5support.so.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libkrb5support.so.0.1
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/liblber-2.5.so.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/liblber-2.5.so.0.1.8
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/liblber.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libldap-2.5.so.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libldap-2.5.so.0.1.8
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libldap.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libprotobuf-lite.so.24.4.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libprotobuf.so.24.4.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libsasl2.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libsasl2.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libsasl2.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libssl.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/libssl.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libanonymous.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libanonymous.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libanonymous.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libcrammd5.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libcrammd5.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libcrammd5.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libdigestmd5.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libdigestmd5.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libdigestmd5.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libgs2.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libgs2.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libgs2.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libgssapiv2.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libgssapiv2.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libgssapiv2.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libplain.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libplain.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libplain.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libscram.so
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libscram.so.3
mysql-8.0.37-linux-glibc2.12-x86_64/lib/private/sasl2/libscram.so.3.0.0
mysql-8.0.37-linux-glibc2.12-x86_64/share/
mysql-8.0.37-linux-glibc2.12-x86_64/share/install_rewriter.sql
mysql-8.0.37-linux-glibc2.12-x86_64/share/uninstall_rewriter.sql
[root@localhost soft]# ll
total 612464
drwxr-xr-x. 9 root root 129 Jun 4 18:42 mysql-8.0.37-linux-glibc2.12-x86_64
-rw-r--r--. 1 root root 627159428 Jun 4 18:38 mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz
[root@localhost soft]# mv mysql-8.0.37-linux-glibc2.12-x86_64 mysql
[root@localhost soft]# cd mysql
[root@localhost mysql]# ll
total 292
drwxr-xr-x. 2 7161 31415 4096 Mar 28 05:39 bin
drwxr-xr-x. 2 7161 31415 38 Mar 28 05:39 docs
drwxr-xr-x. 3 7161 31415 4096 Mar 28 05:39 include
drwxr-xr-x. 6 7161 31415 201 Mar 28 05:39 lib
-rw-r--r--. 1 7161 31415 282187 Mar 28 03:22 LICENSE
drwxr-xr-x. 4 7161 31415 30 Mar 28 05:39 man
-rw-r--r--. 1 7161 31415 666 Mar 28 03:22 README
drwxr-xr-x. 28 7161 31415 4096 Mar 28 05:39 share
drwxr-xr-x. 2 7161 31415 77 Mar 28 05:39 support-files
#关闭防火墙
[root@localhost mysql]# systemctl stop firewalld
[root@localhost mysql]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost mysql]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

Jun 04 18:27:39 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 04 18:27:39 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Jun 04 18:42:46 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jun 04 18:42:46 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
 #建立用户和组
[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd -r -g mysql -s /bin/false mysql
 #创建相关目录
[root@localhost mysql]# mkdir -p /data/mysql
[root@localhost mysql]# chown -R mysql:mysql /data
[root@localhost mysql]# chown -R mysql:mysql /soft
[root@localhost mysql]# chmod 750 /data
#配置环境变量
 #配置 root 用户环境变量
[root@localhost mysql]# cat /root/.bash_profile
> export PATH=\$PATH:/soft/mysql/bin
> EOF
 ##生效环境变量
[root@localhost mysql]# source /root/.bash_profile
 #安装依赖包
 ##挂载镜像源
[root@localhost mysql]# mount /dev/cdrom /mnt
mount: no medium found on /dev/sr0
[root@localhost mysql]# mount /dev/cdrom /mnt
mount: /dev/sr0 is write-protected, mounting read-only
 ##配置yum源
[root@localhost mysql]# cat /etc/yum.repos.d/local.repo
> [local]
> name=local
> baseurl=file:///mnt
> gpgcheck=0
> enabled=1
> EOF
[root@localhost mysql]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ll
total 36
-rw-r--r--. 1 root root 1664 Nov 23 2018 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Nov 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Nov 23 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Nov 23 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Nov 23 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Nov 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 Nov 23 2018 CentOS-Vault.repo
-rw-r--r--. 1 root root 60 Jun 4 18:46 local.repo
[root@localhost yum.repos.d]# rm -rf CentOS-*
[root@localhost yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 60 Jun 4 18:46 local.repo
 ##安装依赖包
[root@localhost yum.repos.d]# yum install -y libaio
Loaded plugins: fastestmirror
Determining fastest mirrors
local | 3.6 kB 00:00:00
(1/2): local/group_gz | 166 kB 00:00:00
(2/2): local/primary_db | 3.1 MB 00:00:00
Package libaio-0.3.109-13.el7.x86_64 already installed and latest version
Nothing to do
#卸载自带mariadb和mysql
检查系统是否安装mysql:rpm -qa | grep mysql,因为我是最小化安装所以没有
[root@localhost yum.repos.d]# rpm -qa | grep mysql
 如果有则强制卸载:rpm -e --nodeps $(rpm -qa | grep mysql)
[root@localhost yum.repos.d]# rpm -e --nodeps $(rpm -qa | grep mysql)
rpm: no packages given for erase
 检查系统是否安装mariadb:rpm -qa | grep mariadb
[root@localhost yum.repos.d]# rpm -qa | grep mariadb
mariadb-libs-5.5.60-1.el7_5.x86_64
 #如果有则强制卸载:rpm -e --nodeps $(rpm -qa | grep mariadb),这里卸载成功。
[root@localhost yum.repos.d]# rpm -e --nodeps $(rpm -qa | grep mariadb)
 #MySQL 初始化
#初始化 MySQL 数据库
#通过以下命令初始化创建 MySQL 数据库 参数:--basedir 为mysql解压目录,--datadir 为mysql数据存放目录
[root@localhost yum.repos.d]# mysqld --initialize --user=mysql --basedir=/soft/mysql --datadir=/data/mysql/
2024-06-04T10:49:56.002523Z 0 [System] [MY-013169] [Server] /soft/mysql/bin/mysqld (mysqld 8.0.37) initializing of server in progress as process 16724
2024-06-04T10:49:56.014189Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-06-04T10:49:56.585737Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-06-04T10:49:59.876036Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: sfPhT>kMv7.b
 # 注意:这里框出的是root用户的初始密码:sfPhT>kMv7.b
#配置 my.cnf
#配置 my.cnf 文件
[root@localhost yum.repos.d]# cat [mysqld]
> user=mysql
> basedir=/soft/mysql
> datadir=/data/mysql
> server_id=6
> port=3306
> socket=/tmp/mysql.sock
> ##客户端
> [mysql]
> socket=/tmp/mysql.sock
> prompt=root [\\\\d]>
> EOF
[root@localhost yum.repos.d]# cat /etc/my.cnf
[mysqld]
user=mysql
basedir=/soft/mysql
datadir=/data/mysql
server_id=6
port=3306
socket=/tmp/mysql.sock
##客户端
[mysql]
socket=/tmp/mysql.sock
prompt=root [\\d]>
 #启动 MySQL 服务:
[root@localhost yum.repos.d]# /soft/mysql/support-files/mysql.server start
Starting MySQL.Logging to '/data/mysql/localhost.localdomain.err'.
. SUCCESS!
 #当然 MySQL 服务也可以配置开机自启动
 #配置 MySQL 开机自启 「Linux 6&7 通用配置方式
[root@localhost yum.repos.d]# cp /soft/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost yum.repos.d]# chkconfig mysqld on
[root@localhost yum.repos.d]# chkconfig --list mysqld

Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.

If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.

mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
 #配置完之后就可以用 service mysqld start 启动 MySQL 服务!
[root@localhost yum.repos.d]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[root@localhost yum.repos.d]# service mysqld start
Starting MySQL. SUCCESS!
#Linux7配置方式
 ##配置mysqld.service文件:
[root@localhost yum.repos.d]# cat /usr/lib/systemd/system/mysqld.service
> [Unit]
> Description=MySQL Server
> Documentation=man:mysqld(8)
> Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
> After=network.target
> After=syslog.target
> [Install]
> WantedBy=multi-user.target
> [Service]
> User=mysql
> Group=mysql
> ExecStart=/soft/mysql/bin/mysqld --defaults-file=/etc/my.cnf
> LimitNOFILE = 5000
> EOF
[root@localhost yum.repos.d]# systemctl enable mysqld
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
 #配置完之后就可以用 systemctl start mysqld 启动mysql服务
[root@localhost yum.repos.d]# systemctl stop mysqld
[root@localhost yum.repos.d]# systemctl start mysqld
[root@localhost yum.repos.d]# systemctl start mysqld
#修改 MySQL ROOT 密码 尝试连接mysql数据库
#由于初始密码不好记,因此需要修改数据库 root 用户初始密码!
[root@localhost mysql]# mysqladmin -uroot -psfPhT>kMv7.b password mysql
[root@localhost mysql]# mysql -uroot -pmysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.37 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root [(none)]>show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)

root [(none)]>exit
Bye
[root@localhost mysql]# #新密码为:mysql 至此安装完毕
[root@localhost mysql]# mysql -uroot -pmysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.37 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root [(none)]>show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论