DBA需要安裝MySQL數據庫,安裝過程如下:
1. 下載MySQL軟件。訪問MySQL官網,找到合適的版本并下載安裝包。
2. 安裝MySQL軟件。使用管理員權限打開安裝包并按照提示進行安裝。
3. 配置MySQL。在MySQL安裝目錄下,找到my.ini(Windows)或者my.cnf(Unix)文件。通過修改配置文件設置MySQL的參數,如端口號、緩存大小等。
# Example MySQL config file for medium systems. # # This is for a large system with memory = 512M where the system runs mainly # MySQL. # # MySQL programs look for option files in a set of file locations which depend # on the deployment platform. # You can copy this option file to one of those, and then rename it to # 'my.cnf' if you like. # # More detailed information about the individual options can be found in the # manual. # [client] port = 3306 socket = /tmp/mysql.sock [mysqld] port = 3306 socket = /tmp/mysql.sock skip-locking set-variable = key_buffer=16M set-variable = max_allowed_packet=1M set-variable = table_cache=64 set-variable = sort_buffer=512K set-variable = net_buffer_length=8K set-variable = myisam_sort_buffer_size=8M # Don't allow more than 300 connections: set-variable = max_connections=300 # Extra logging: log = /var/log/mysql/mysql.log log-error = /var/log/mysql/mysql.err [mysqldump] quick set-variable = max_allowed_packet=16M [mysql] no-auto-rehash [isamchk] set-variable = key_buffer=256M set-variable = sort_buffer=256M set-variable = read_buffer=2M set-variable = write_buffer=2M [myisamchk] set-variable = key_buffer=256M set-variable = sort_buffer=256M set-variable = read_buffer=2M set-variable = write_buffer=2M [mysqlhotcopy] interactive-timeout
4. 啟動MySQL。在命令行窗口輸入啟動命令并回車,如下所示:
# Windows C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld # Unix sudo /usr/local/mysql/support-files/mysql.server start
至此,MySQL數據庫就已經成功安裝并啟動。DBA可以通過客戶端工具或者命令行窗口管理MySQL數據庫,如創建用戶、授權、備份等操作。