MySQL 的安装同样简单,我们用yum安装完后,直接用它提供的脚本进行设置,然后再进行微调。
sudo yum install mysql mysql-server
然后我们启动它
sudo service mysqld start
你会看到有提示
Alternatively you can run:
/usr/bin/mysql_secure_installation
我们就用sudo来运行,然后按照提示办就可以了。
然后我们需要设置/etc/my.cnf 这个文件是MySQL 的配置文件,其具体参数根据自己的需要进行微调吧。如果不使用MySQL的远程登陆功能,建议添加 skip-networking
[mysqld] character-set-server = utf8 skip-networking skip-external-locking key_buffer = 16M sort_buffer_size = 512K net_buffer_length = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K join_buffer_size = 256K max_connections = 2000 wait_timeout = 10 thread_concurrency = 8 query_cache_size = 16M tmp_table_size = 16M #innodb_log_file_size = 32M #innodb_log_buffer_size = 8M #innodb_buffer_pool_size = 32M #innodb_additional_mem_pool_size = 16M [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid