MySQL 8 二进制文件安装 概述mysql官方 https://www.mysql.com/社区版下载地址 https://dev.mysql.com/downloads/检查是否安装mariadb如果有先卸载rpm-qa|grepmariadb[rootCentos7-2243 config]# rpm -qa|grep mariadbmariadb-libs-5.5.68-1.el7.x86_64[rootCentos7-2243 config]# yum remove -y mariadb-libs-5.5.68https://dev.mysql.com/downloads/mysql/tar-xvfmysql-8.4.2-linux-glibc2.17-x86_64.tar.xzmvmysql-8.4.2-linux-glibc2.17-x86_64 /usr/local/mysql8.4.2useradd-s/sbin/nologin mysql安装依赖yuminstalllibaio-devel libaio-develcd/usr/local/mysql8.4.2mkdir/public/mysqldb/datamkdir/public/mysqldb/logsmkdir/public/mysqldb/tmpmkdir/etc/mysql增加环境变量vim/etc/profileexportMYSQL_HOME/usr/local/mysql8.4.2/PATH$MYSQL_HOME/bin:$PATHexportPATHsource/etc/profile简单配置my_3306.cnfvim/etc/mysql/my_3306.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/8.2/en/server-configuration-defaults.html[mysqld]## Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size 128M## Remove the leading # to disable binary logging# Binary logging captures changes between backups and is enabled by# default. Its default setting is log_binbinlog# disable_log_bin## Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size 128M# sort_buffer_size 2M# read_rnd_buffer_size 2M## Remove leading # to revert to previous value for default_authentication_plugin,# this will increase compatibility with older clients. For background, see:# https://dev.mysql.com/doc/refman/8.2/en/server-system-variables.html#sysvar_default_authentication_plugin# default-authentication-pluginmysql_native_password# 设置3306端口port3306socket/public/mysqldb/tmp/mysql.sockmysqlx_socket/public/mysqldb/tmp/mysqlx.sock pid-file/public/mysqldb/tmp/mysqld.pid# 设置mysql的安装目录basedir/usr/local/mysql8.4.2# 设置mysql数据库的数据的存放目录datadir/public/mysqldb/data# 允许最大连接数max_connections10000# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统max_connect_errors10# 服务端使用的字符集默认为UTF8character-set-serverutf8mb4# 创建新表时将使用的默认存储引擎default-storage-engineINNODB# 默认使用“mysql_native_password”插件认证mysql_native_passwordON#default_authentication_pluginmysql_native_password[mysql]# 设置mysql客户端默认字符集default-character-setutf8mb4[client]# 设置mysql客户端连接服务端时默认使用的端口port3306socket/public/mysqldb/tmp/mysql.sockln-s/etc/mysql/my_3306.cnf /etc/my_3306.cnfchown-Rmysql:mysql /usr/local/mysql8.4.2chown-Rmysql:mysql /public/mysqldbchown-Rmysql:mysql /etc/mysql初始化数据库cd/usr/local/mysql8.4.2/bin ./mysqld --defaults-file/etc/my_3306.cnf--initialize--console查看临时密码greppassword/public/mysqldb/logs/mysql_3306-error.log[rootvm172-16-0-6 bin]# ./mysqld --defaults-file/etc/my_3306.cnf --initialize --console2024-08-26T09:53:04.661185Z0[System][MY-015017][Server]MySQL Server Initialization - start.2024-08-26T09:53:04.664608Z0[System][MY-013169][Server]/usr/local/mysql-8.4.2/bin/mysqld(mysqld8.4.2)initializing of serverinprogress as process310692024-08-26T09:53:04.688642Z1[System][MY-013576][InnoDB]InnoDB initialization has started.2024-08-26T09:53:06.509597Z1[System][MY-013577][InnoDB]InnoDB initialization has ended.2024-08-26T09:53:10.162534Z6[Note][MY-010454][Server]A temporary password is generatedforrootlocalhost: WXyl%a7pZms2024-08-26T09:53:13.891230Z0[System][MY-015018][Server]MySQL Server Initialization - end.启动mysql服务器./mysqld_safe --defaults-file/etc/my_3306.cnf[rootvm172-16-0-6 support-files]# netstat -nltp | grep 3306tcp600:::33060 :::* LISTEN20232/mysqld tcp600:::3306 :::* LISTEN20232/mysqld登录mysql[rootcentos7-05145 bin]# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with;or\g. Your MySQL connectionidis10Server version:8.4.2 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. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. mysql修改root密码mysqlALTERUSERrootlocalhostIDENTIFIEDWITHmysql_native_passwordBYyourpassword;mysqlusemysql;Readingtableinformationforcompletionoftableandcolumnnames You can turnoffthis featuretoget a quicker startupwith-ADatabasechanged mysqlmysqlselectuser,hostfromuser;-----------------------------|user|host|-----------------------------|root|localhost||mysql.infoschema|localhost||mysql.session|localhost||mysql.sys|localhost|-----------------------------4rowsinset(0.00sec)mysqlUPDATEUSERSEThost%WHEREuserroot;mysqlFLUSHPRIVILEGES;mysqlexit关闭mysql服务bash./mysqladmin-h127.0.0.1-u root-P3306-pshutdown配置systemd服务脚本cd/usr/local/mysql8.4.2/support-filesvimmysqld.service[Unit]DescriptionMySQL ServerDocumentationman:mysqld(8)Documentationhttp://dev.mysql.com/doc/refman/en/using-systemd.htmlAfternetwork.targetAftersyslog.target[Install]WantedBymulti-user.target[Service]UsermysqlGroupmysql# Have mysqld write its state to the systemd notify socketTypenotify# Disable service start and stop timeout logic of systemd for mysqld service.TimeoutSec0# Start main serviceExecStart/usr/local/mysql-8.4.2/bin/mysqld --defaults-file/etc/my_3306.cnf$MYSQLD_OPTS# Use this to switch malloc implementationEnvironmentFile-/etc/sysconfig/mysql# Sets open_files_limitLimitNOFILE141082Restarton-failureRestartPreventExitStatus1# Set environment variable MYSQLD_PARENT_PID. This is required for restart.EnvironmentMYSQLD_PARENT_PID1PrivateTmpfalseln-s/usr/local/mysql8.4.2/support-files/mysqld.service /etc/systemd/system/systemctl daemon-reload systemctl start mysqld登录数据库测试/usr/local/mysql8.4.2/bin/mysql-uroot-p-S/public/mysqldb/tmp/mysql.sock使用IP登录mysql bash mysql -u root -h 127.0.0.1 -pWelcome to the MySQL monitor. Commands end with;or\g. Your MySQL connectionidis16Server version:8.4.2 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. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. mysqlselectversion;-----------|version|-----------|8.4.2|-----------1rowinset(0.00sec)

相关新闻

最新新闻

C:小球自由落体运动

C:小球自由落体运动

任务描述:一球从M米高度自由下落,每次落地后返回原高度的一半,再落下。 它在第N次落地时反弹多高?共经过多少米? 结果保留两位小数。编程要求:输入:从键盘输入M和N的值。输出:它在第…

2026/8/1 20:50:38
Axure:最全的快捷键集锦!(Windows+Mac)

Axure:最全的快捷键集锦!(Windows+Mac)

【免费】AxureRP11安装包汉化包 链接:https://pan.baidu.com/s/1ZGDcfEks9hg8DrozKl2EqA?pwdlax8 提取码:lax8 【免费】AxureRP10安装包汉化包 链接:https://pan.baidu.com/s/1owWvGQSk-DWn7ttAGngINg?pwdlax8 提取码:lax8 【免费】AxureRP9安装包汉化…

2026/8/1 20:50:38
Axure:元件库的下载及导入!(附大厂元件库和原型素材)

Axure:元件库的下载及导入!(附大厂元件库和原型素材)

【免费】AxureRP11安装包汉化包 链接:https://pan.baidu.com/s/1ZGDcfEks9hg8DrozKl2EqA?pwdlax8 提取码:lax8 【免费】AxureRP10安装包汉化包 链接:https://pan.baidu.com/s/1owWvGQSk-DWn7ttAGngINg?pwdlax8 提取码:lax8 【免费】AxureRP9安装包汉化…

2026/8/1 20:50:38
3D动画制作公司排名(2026年)

3D动画制作公司排名(2026年)

3D动画行业已高度分化,不同赛道的技术要求和核心能力完全不同。选择服务商的首要标准是“赛道匹配”——房地产动画、工业动画、影视动画是三种完全不同的业务逻辑。 以下结合2026年行业公开数据,按核心赛道分类梳理头部公司。全球市场规模:2…

2026/8/1 20:50:38
基于plc的物料分拣1234(设计源文件+万字报告+讲解)(支持资料、图片参考_相关定制)_文章底部可以扫码1234

基于plc的物料分拣1234(设计源文件+万字报告+讲解)(支持资料、图片参考_相关定制)_文章底部可以扫码1234

基于plc的物料分拣1234(设计源文件万字报告讲解)(支持资料、图片参考_相关定制)_文章底部可以扫码1234 西门子博图S7-1200plc与触摸屏HMI的物料分拣系统设计,物流分拣 基于plc的物料分拣 基于西门子PLC的智能物流/快递分类设计 基于西门子s7-…

2026/8/1 20:50:38
黑苹果终极配置指南:Hackintool 3.9.7 从问题识别到性能调优的完整实战

黑苹果终极配置指南:Hackintool 3.9.7 从问题识别到性能调优的完整实战

黑苹果终极配置指南:Hackintool 3.9.7 从问题识别到性能调优的完整实战 【免费下载链接】Hackintool The Swiss army knife of vanilla Hackintoshing 项目地址: https://gitcode.com/gh_mirrors/ha/Hackintool Hackintool 是黑苹果社区中最强大的硬件配置诊…

2026/8/1 20:45:38