mac m2停止mysql报错:ERROR! MySQL server PID file could not be found!

这篇具有很好参考价值的文章主要介绍了mac m2停止mysql报错:ERROR! MySQL server PID file could not be found!。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1、确认本机是否有my.cnf文件

出现这个问题的原因有很多,我只说下我是怎么解决的。
首先看一下,你的mysql服务,有没有指定配置文件。

#进入mysql的bin目录,和你自己的安装位置有关系
/usr/local/mysql/bin
#执行如下命令
mysql --verbose --help | grep my.cnf

执行完之后,会输出几个可能的目录,你可以到各个目录下看看有没有my.cnf文件。如果没有,那就需要新建一个。

2、新建my.cnf文件

进入/etc目录,可能需要root权限,使用如下命令切换root用户,需要输入你进入mac的密码

sudo su -

然后在etc目录下新建一个my.cnf文件,复制如下内容到my.cnf文件中。

[client]

port                           = 3306                              # default 3306
socket                         = %SOCKET%                            # Use mysqld.sock on Ubuntu, conflicts with AppArmor otherwise


[mysql]

no_auto_rehash
max_allowed_packet             = 16M
prompt                         = '\u@\h [\d]> '                      # 'user@host [schema]> '
default_character_set          = utf8                                # Possibly this setting is correct for most recent Linux systems


[mysqldump]

max_allowed_packet             = 16M


[mysqld]

# Connection and Thread variables

port                           = 3306                                # default 3306
socket                         = %SOCKET%                              # Use mysqld.sock on Ubuntu, conflicts with AppArmor otherwise
basedir                        = %BASEDIR%
datadir                        = /usr/local/mysql/data
# tmpdir                         = '%INSTANCEDIR%/tmp'
# innodb_tmpdir                  = '%INSTANCEDIR%/tmp'                 # MySQL 5.7 ff.

max_allowed_packet             = 16M
default_storage_engine         = InnoDB
# explicit_defaults_for_timestamp = 1                                  # MySQL 5.6 ff. default in MySQL 8.0, test carefully! This can have an impact on application.
# disable_partition_engine_check  = true                               # Since MySQL 5.7.17 to 5.7.20. To get rid of nasty message in error log

# character_set_server           = utf8mb4                             # For modern applications, default in MySQL 8.0
# collation_server               = utf8mb4_general_ci


max_connections                = 151                                 # Values < 1000 are typically good
max_user_connections           = 145                                 # Limit one specific user/application
thread_cache_size              = 151                                 # Up to max_connections makes sense


# Query Cache (does not exist in MySQL 8.0 any more!)

# query_cache_type               = 1                                   # Set to 0 to avoid global QC Mutex, removed in MySQL 8.0
# query_cache_size               = 32M                                 # Avoid too big (> 128M) QC because of QC clean-up lock!, removed in MySQL 8.0


# Session variables

sort_buffer_size               = 2M                                  # Could be too big for many small sorts
tmp_table_size                 = 32M                                 # Make sure your temporary results do NOT contain BLOB/TEXT attributes

read_buffer_size               = 128k                                # Resist to change this parameter if you do not know what you are doing
read_rnd_buffer_size           = 256k                                # Resist to change this parameter if you do not know what you are doing
join_buffer_size               = 128k                                # Resist to change this parameter if you do not know what you are doing


# Other buffers and caches

table_definition_cache         = 1400                                # As big as many tables you have
table_open_cache               = 2000                                # connections x tables/connection (~2)
table_open_cache_instances     = 16                                  # New default in 5.7


# MySQL error log

log_error                      = %INSTANCEDIR%/log/%UNAME%_%INSTANCE%_error.log   # Adjust AppArmor configuration: /etc/apparmor.d/local/usr.sbin.mysqld
# log_timestamps                 = SYSTEM                              # MySQL 5.7, equivalent to old behaviour
# log_warnings                   = 2                                   # MariaDB equivalent to log_error_verbosity = 3, MySQL does NOT support this any more!
# log_error_verbosity            = 3                                   # MySQL 5.7 ff., equivalent to log_warnings = 2, MariaDB does NOT support this!
innodb_print_all_deadlocks     = 1
# wsrep_log_conflicts            = 1                                   # for Galera only!


# Slow Query Log

slow_query_log_file            = %INSTANCEDIR%/log/%UNAME%_%INSTANCE%_slow.log   # Adjust AppArmor configuration: /etc/apparmor.d/local/usr.sbin.mysqld
slow_query_log                 = 0
log_queries_not_using_indexes  = 0                                   # Interesting on developer systems!
long_query_time                = 0.5
min_examined_row_limit         = 100


# General Query Log

general_log_file               = %INSTANCEDIR%/log/%UNAME%_%INSTANCE%_general.log   # Adjust AppArmor configuration: /etc/apparmor.d/local/usr.sbin.mysqld
general_log                    = 0


# Performance Schema

# performance_schema             = ON                                  # for MariaDB 10 releases
performance_schema_consumer_events_statements_history_long = ON      # MySQL 5.6/MariaDB 10 and newer
# performance_schema_instrument  = 'memory/%=COUNTED'


# Binary logging and Replication

server_id                      = %SERVERID%                            # Must be set on MySQL 5.7 and newer if binary log is enabled!
log_bin                        = %INSTANCEDIR%/binlog/%UNAME%_%INSTANCE%_binlog            # Locate outside of datadir, adjust AppArmor configuration: /etc/apparmor.d/local/usr.sbin.mysqld
# master_verify_checksum         = ON                                  # MySQL 5.6 / MariaDB 10.2
# binlog_cache_size              = 1M                                    # For each connection!
# binlog_stmt_cache_size         = 1M                                    # For each connection!
max_binlog_size                = 128M                                # Make bigger for high traffic to reduce number of files
sync_binlog                    = 1                                   # Set to 0 or higher to get better write performance, default since MySQL 5.7
expire_logs_days               = 5                                   # We will survive Easter holidays
# binlog_expire_logs_seconds     = 432000                              # MySQL 8.0, 5 days * 86400 seconds
binlog_format                  = ROW                                 # Use MIXED if you want to experience some troubles, default since MySQL 5.7, MariaDB default is MIXED
# binlog_row_image               = MINIMAL                             # Since 5.6, MariaDB 10.1
# auto_increment_increment       = 2                                   # For Master/Master set-ups use 2 for both nodes
# auto_increment_offset          = 1                                   # For Master/Master set-ups use 1 and 2


# Slave variables

log_slave_updates              = 1                                   # Use if Slave is used for Backup and PiTR, default since MySQL 8.0
read_only                      = 0                                   # Set to 1 to prevent writes on Slave
# super_read_only                = 0                                   # Set to 1 to prevent writes on Slave for users with SUPER privilege. Since 5.7, not in MariaDB
# skip_slave_start               = 1                                   # To avoid start of Slave thread
# relay_log                      = %UNAME%_%INSTANCE%_relay-bin
# relay_log_info_repository      = TABLE                               # MySQL 5.6, default since MySQL 8.0, MySQL only
# master_info_repository         = TABLE                               # MySQL 5.6, default since MySQL 8.0, MySQL only
# slave_load_tmpdir              = '%INSTANCEDIR%/tmp'                 # defaults to tmpdir


# Crash-safe replication Master

# binlog_checksum                = CRC32                               # default
# sync_binlog                    = 1                                   # default since 5.7.6, but slow!
# innodb_support_xa              = 1                                   # default, depracted since 5.7.10


# Crash-safe replication Slave

# relay_log_info_repository      = TABLE                               # MySQL 5.6, default since MySQL 8.0, MySQL only
# master_info_repository         = TABLE                               # MySQL 5.6, default since MySQL 8.0, MySQL only
# relay_log_recovery             = 1
# sync_relay_log_info            = 1                                   # default 10000
# relay_log_purge                = 1                                   # default
# slave_sql_verify_checksum      = 1                                   # default


# GTID replication

# gtid_mode                        = ON                                  # MySQL only, Master and Slave
# enforce_gtid_consistency         = 1                                   # MySQL only, Master and Slave

# log_bin                          = %INSTANCEDIR%/binlog/%UNAME%_%INSTANCE%_binlog   # In 5.6 also on Slave
# log_slave_updates                = 1                                   # In 5.6 also on Slave


# Security variables

# local_infile                   = 0                                   # If you are security aware
# secure_auth                    = 1                                   # If you are security aware
# sql_mode                       = TRADITIONAL,ONLY_FULL_GROUP_BY,NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO   # Be careful changing this afterwards, NO_AUTO_CREATE_USER does NOT exist any more in MySQL 8.0
# skip_name_resolve              = 0                                   # Set to 1 if you do not trust your DNS or experience problems
# secure_file_priv               = '%INSTANCEDIR%/tmp'                   # chmod 750, adjust AppArmor configuration: /etc/apparmor.d/local/usr.sbin.mysqld


# MyISAM variables

key_buffer_size                = 8M                                  # Set to 25 - 33 % of RAM if you still use MyISAM
myisam_recover_options         = 'BACKUP,FORCE'
# disabled_storage_engines       = 'MyISAM,MEMORY'                     # MySQL 5.7, do NOT during/before mysql_upgrade, good for Galera!


# MEMORY variables

max_heap_table_size            = 64M                                 # Should be greater or equal to tmp_table_size


# InnoDB variables

innodb_strict_mode             = ON                                  # Default since MySQL 5.7, and MariaDB 10.4
innodb_buffer_pool_size        = 128M                                # Go up to 75% of your available RAM
# innodb_buffer_pool_instances   = 8                                   # Bigger if huge InnoDB Buffer Pool or high concurrency, desupported in MariaDB 10.5 ff.

innodb_file_per_table          = 1                                   # Is the recommended way nowadays
# innodb_flush_method            = O_DIRECT                            # O_DIRECT is sometimes better for direct attached storage
# innodb_write_io_threads        = 8                                   # If you have a strong I/O system or SSD
# innodb_read_io_threads         = 8                                   # If you have a strong I/O system or SSD
# innodb_io_capacity             = 1000                                # If you have a strong I/O system or SSD

innodb_flush_log_at_trx_commit = 2                                   # 1 for durability, 0 or 2 for performance
innodb_log_buffer_size         = 16M                                 # Bigger if innodb_flush_log_at_trx_commit = 0
innodb_log_file_size           = 256M                                # Bigger means more write throughput but longer recovery time
# innodb_log_files_in_group      = 2                                   # Desupported in MariaDB 10.6

                                                                     # Since MariaDB 10.0 and MySQL 5.6
innodb_monitor_enable = all                                          # Overhead < 1% according to PeterZ/Percona


# Galera specific MySQL parameter

# default_storage_engine         = InnoDB                            # Galera only works with InnoDB
# innodb_flush_log_at_trx_commit = 2                                 # Durability is achieved by committing to the Group
# innodb_autoinc_lock_mode       = 2                                 # For parallel applying
# binlog_format                  = row                               # Galera only works with RBR
# query_cache_type               = 0                                 # Use QC with Galera only in a Master/Slave set-up, removed in MySQL 8.0
# query_cache_size               = 0                                 # removed in MySQL 8.0
# log_slave_updates              = ON                                # Must be enabled on ALL Galera nodes if binary log is enabled!
# server_id                      = ...                               # Should be equal on all Galera nodes according to Codership CTO if binary log is enabled.


# WSREP parameter

# wsrep_on                       = on                                  # Only MariaDB >= 10.1
# wsrep_provider                 = /usr/lib/galera/libgalera_smm.so    # Location of Galera Plugin on Ubuntu ?
# wsrep_provider                 = /usr/lib64/galera-3/libgalera_smm.so   # Location of Galera v3 Plugin on CentOS 7
# wsrep_provider                 = /usr/lib64/galera-4/libgalera_smm.so   # Location of Galera v4 Plugin on CentOS 7
# wsrep_provider_options         = 'gcache.size = 1G'                  # Depends on you workload, WS kept for IST
# wsrep_provider_options         = 'gcache.recover = on'               # Since 3.19, tries to avoid SST after crash

# wsrep_cluster_name             = "My cool Galera Cluster"            # Same Cluster name for all nodes
# wsrep_cluster_address          = "gcomm://192.168.0.1,192.168.0.2,192.168.0.3"   # Start other nodes like this

# wsrep_node_name                = "Node A"                            # Unique node name
# wsrep_node_address             = 192.168.0.1                         # Our address where replication is done
# wsrep_node_incoming_address    = 10.0.0.1                            # Our external interface where application comes from
# wsrep_sync_wait                = 1                                   # If you need realy full-synchronous replication (Galera 3.6 and newer)
# wsrep_slave_threads            = 16                                  # 4 - 8 per core, not more than wsrep_cert_deps_distance

# wsrep_sst_method               = rsync                               # SST method (initial full sync): mysqldump, rsync, rsync_wan, xtrabackup-v2
# wsrep_sst_auth                 = sst:secret                          # Username/password for sst user
# wsrep_sst_receive_address      = 192.168.2.1                         # Our address where to receive SST


# Group Replication parameter

# default_storage_engine         = InnoDB                              # Group Replication only works with InnoDB
# server_id                      = %SERVERID%                          # Should be different on all 3 nodes
# log_bin                        = %INSTANCEDIR%/binlog/%UNAME%_%INSTANCE%_binlog   # Locate outside of datadir, adjust AppArmor configuration: /etc/apparmor.d/local/usr.sbin.mysqld
# binlog_format                  = ROW
# binlog_checksum                = NONE                                # not default!
# gtid_mode                      = ON
# enforce_gtid_consistency       = ON
# master_info_repository         = TABLE
# relay_log_info_repository      = TABLE
# log_slave_updates              = ON

# slave_parallel_workers         =                                  # 1-2/core, max. 10
# slave_preserve_commit_order    = ON
# slave_parallel_type            = LOGICAL_CLOCK

# transaction_write_set_extraction            = XXHASH64

# loose-group_replication_group_name          = "$(uuidgen)"           # Must be the same on all nodes
# loose-group_replication_start_on_boot       = OFF
# loose-group_replication_local_address       = "192.168.0.1"
# loose-group_replication_group_seeds         = "192.168.0.1,192.168.0.2,192.168.0.3"   # All nodes of Cluster
# loose-group_replication_bootstrap_group     = OFF
# loose-group_replication_single_primary_mode = FALSE                  # = multi-primary

3、修改my.cnf文件

只需要修改3处配置。两个port,和一个datadir。
datadir一般是/usr/local/mysql/data,根据你自己的目录情况修改即可。

4、重启mysql、关闭mysql

重启mysql。

/usr/local/mysql/support-files/mysql.server restart

再关闭mysql试试,应该就可以成功了文章来源地址https://www.toymoban.com/news/detail-486521.html

/usr/local/mysql/support-files/mysql.server stop

到了这里,关于mac m2停止mysql报错:ERROR! MySQL server PID file could not be found!的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【填坑向】MySQL常见报错及处理系列(ERROR! The server quit without updating PID file)

    本系列其他文章 【填坑向】MySQL常见报错及处理系列(Communications link failure Access denied for user ‘root‘@‘localhost‘)_AQin1012的博客-CSDN博客 翻一下大致的意思就是默认会按照如下的顺序读取配置文件,我上面贴出的配置文件就是第一个/etc/my.cnf,但显然目前在运行的MySQL并不是

    2024年02月11日
    浏览(42)
  • 【黄啊码】mysql启动报错:The server quit without updating PID file[网上的都是坑货]

    大家好,我是黄啊码,最近在手动安装mysql的时候遇到了一点问题,然后按照网友们的操作,没一次成功,最终在一位大佬的指导下,终于解决了,特地整理如下: 原因分析:上一次关机前未正常关闭MySQL 解决方案:删除进程锁文件 /var/lock/subsys/mysql  原因分析:可能进程里

    2024年02月01日
    浏览(44)
  • MySQL:提示:The server quit without updating PID file问题的解决办法

    具体什么原因最好的办法是先查看下错误日志: 1、可能是/usr/local/mysql/data/mysql.pid文件没有写的权限  解决方法 :给予权限,然后重新启动mysqld! 2、可能进程里已经存在mysql进程 解决方法:使用“kill -9  进程号”杀死,然后重新启动mysqld 3、可能是第二次在机器上安装mys

    2024年01月25日
    浏览(48)
  • ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option 解决办法

    情景 当我导入大数据量时,使用 LOAD DATA INFILE 进行导入,出现了错误 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 表明你的 MySQL 服务器启用了 --secure-file-priv 选项,这个选项限制了 MySQL 可以执行文件操作的目录。这通常出现在尝

    2024年04月28日
    浏览(42)
  • Mac M2芯片免安装版mysql

    先看一下本机mac信息 左上角,单机苹果的logo,然后单击“关于本机”,可以看到当前mac的信息 看这个信息的目的是:你在官网下载mysql的时候,不要再下载x86版本,要现在arm版本,因为苹果的M2芯片是基于arm架构。 下载mysql的路径:https://dev.mysql.com/downloads/mysql/ 注意下载ar

    2024年02月13日
    浏览(64)
  • 解决远程连接MySQL报错:2003 - Can‘t connect to MySQL server on ‘X.X.X.X‘ (10060 “Unknown error“)问题

    问题 先看报错: 2003 - Can’t connect to MySQL server on ‘X.X.X’ (10060 “Unknown error”)。 意思是服务器远程连接出错:未知错误。 解决方案: 遇到这个问题,首先想到的是权限不够。那咱就给它赋权。 首先登录MySQL数据库:mysql -u用户名 -p密码; 然后:use mysql; 进入数据库后我们先看看

    2024年02月07日
    浏览(72)
  • MySQL报错解决:Error writing file ‘/tmp/XXXX‘ (Errcode: 28 - No space left on device)

    执行sql报错如下: MySQL报错 “Error writing file ‘/tmp/XXXX‘ (Errcode: 28 - No space left on device)” 表明在写入文件时,临时目录(tmpdir) 的设备上没有足够的可用空间 ,可能会导致MySQL无法执行某些操作,如排序或临时表的创建 在MySQL 8中,默认的临时目录(tmpdir)路径取决于操作系

    2024年02月11日
    浏览(40)
  • navicat如何连接MySQL,报错“2003 - Can‘t connect to MySQL server on ‘localhost‘ (10061 “Unknown error“)”处理

    1.打开Navicat,点击左上角的【连接】按钮。 2. 新建连接,大家要注意了,此处新建的是连接,不是新建的数据库,我看到好多人都是把连接名当成库名写上了,这是不对的。可以建多个连接的意思是比如我们可以连接本地的mysql,也可以连接开发环境服务器的mysql,或者测试环境

    2024年02月16日
    浏览(42)
  • mac上mysql启动报错问题Unable to lock ./ibdata1 error: 35

        记录一次mac安装mysql启动报错问题Unable to lock ./ibdata1 error: 35。首先,这是第一次在公司新领的mac上面去安装mysql,在去年换新电脑之前,老电脑也安装过,没出现过这种问题。其次,自己的几台windows笔记本也安装过,也没出现过这样的问题。 目录 一、mysql首次安装后启动

    2024年02月16日
    浏览(49)
  • ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec

    MySQL在进行导出全表数据的时候提示ERROR 1290 出现这个问题的原因是mysql的secure_file_prive这个选项没有开启,或者这个选择了特定的文件路径,只有在这个文件路径下的文件才能导入导出mysql 首先在mysql环境下查询secure_file_priv参数。 参数secure_file_priv的值及含义如下: secure_fil

    2024年02月10日
    浏览(58)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包