skip-external-locking
时间: 2023-04-25 22:03:53 浏览: 59
skip-external-locking的意思是跳过外部锁定。在MySQL中,外部锁定是指在执行某些操作时,需要对表或行进行锁定,以防止其他会话对其进行修改。但是,如果你确定没有其他会话会对这些表或行进行修改,可以使用skip-external-locking选项来跳过外部锁定,从而提高性能。
相关问题
[mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1如果我想让我本地docker里的服务也访问mysql要怎么配置
你需要将 `bind-address` 参数设置为 `0.0.0.0`,这样 MySQL 将会监听所有可用的网络接口,而不仅仅是 `localhost`。在你的配置文件中,将 `bind-address` 的值改为 `0.0.0.0`,然后重新启动 MySQL 服务即可。
修改后的配置文件如下:
```
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
# Listen on all available network interfaces
bind-address = 0.0.0.0
```
修改完配置文件后,需要重新启动 MySQL 服务使得配置生效。
port = 3306 socket = /tmp/mysql.sock datadir = /www/server/data default_storage_engine = InnoDB performance_schema_max_table_instances = 400 table_definition_cache = 400 skip-external-locking key_buffer_size = 256M max_allowed_packet = 100G table_open_cache = 1024 sort_buffer_size = 4M net_buffer_length = 4K read_buffer_size = 4M read_rnd_buffer_size = 256K myisam_sort_buffer_size = 64M thread_cache_size = 128 query_cache_size = 128M tmp_table_size = 128M sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES explicit_defaults_for_timestamp = true #skip-name-resolve max_connections = 500 max_connect_errors = 100 open_files_limit = 65535 log-bin=mysql-bin log_error=/var/log/mysql/error.log binlog_format=mixed server-id = 1 expire_logs_days = 10 slow_query_log=1 slow-query-log-file=/www/server/data/mysql-slow.log long_query_time=3 #log_queries_not_using_indexes=on early-plugin-load = "" innodb_data_home_dir = /www/server/data innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /www/server/data innodb_buffer_pool_size = 1024M innodb_log_file_size = 512M innodb_log_buffer_size = 128M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 innodb_max_dirty_pages_pct = 90 innodb_read_io_threads = 4 innodb_write_io_threads = 4 #skip-grant-tables bind-address = 0.0.0.0 为什么把bind-address改成101.201.118.49就不能用了?
将 的 `bind-address` 配置项更改为特定的 IP 地址会导致 MySQL 仅监听该 IP 地址上的连接请求。如果您将 `bind-address` 修改为 `101.201.118.49` 并且无法连接到 MySQL,可能是由于以下原因之一:
1. 防火墙配置:请确保防火墙允许来自 `101.201.118.49` 的连接请求到达 MySQL 服务器的 `3306` 端口。您可以检查防火墙规则并相应地调整配置。
2. IP 地址绑定的网络接口:如果 `101.201.118.49` 不是该服务器上的有效网络接口地址,MySQL 无法侦听该地址上的连接请求。请确保在服务器上存在具有 `101.201.118.49` IP 地址的网络接口,并且该接口处于活动状态。
3. MySQL 用户权限:检查 MySQL 用户的权限配置,确保允许来自 `101.201.118.49` 的连接请求。您可以使用以下命令检查和修改用户权限:
```
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'101.201.118.49' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
```
请注意,将 `bind-address` 配置项更改为特定的 IP 地址可能会限制仅允许来自该 IP 地址的连接请求。如果您需要允许其他 IP 地址连接到 MySQL,请相应地调整配置。