MySQL是一種常用的關系型數據庫管理系統,而MySQL 8.0.13是最新版本。對于數據庫管理員來說,建立my.ini文件是十分重要的,下面我們來看如何建立。
首先,在MySQL的安裝目錄下找到my-default.ini文件,并復制它,修改文件名為my.ini,然后你就可以在這個文件中配置MySQL的屬性了。以下是my.ini的內容示例:
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html [mysqld] # Set the default character set. # 配置默認字符集 character-set-server=utf8mb4 # The default authentication plugin to be used when connecting to the MySQL # server. Used for all new accounts when no authentication plugin is # specified. This value will be ignored if skip-grant-tables is set and not # as a command-line argument. # # Because this plugin implements authentication over unencrypted connections, # it is only used for initially setting up accounts or for situations where # secure connections are not possible. By default, we assign you the sha256_password # for Windows and sha256_password socket authentication methods. On other # platforms, we assign you the mysql_native_password authentication method. # 安全配置 default_authentication_plugin=sha256_password # Enable or disable logging. # 日志 general_log=0 log-output=FILE general_log_file="C:/mysql/MySQL Server 8.0/Logs/mysql.log" slow_query_log=0 slow_query_log_file="C:/mysql/MySQL Server 8.0/Logs/slowquery.log" long_query_time=10 # The size of the buffer used for index blocks for MyISAM tables. # myisam 配置,忽略 key-buffer-size=8M # The TCP/IP Port the MySQL Server will listen on # 監聽端口 port=3306 # Switch to UNIX_SOCKET on Unix-like systems # socket 配置,忽略 socket=mysql [mysql] no-beep [mysqldump] quick quote-names max_allowed_packet=32M [isamchk] key_buffer=20M sort_buffer_size=20M read_buffer=2M write_buffer=2M
配置好my.ini文件后,將其放到MySQL的數據目錄下,即可重啟MySQL,生效修改。建立好my.ini文件后,管理員就可以進行MySQL的各項配置了。