# yum install mysql mysql-server
# vi /etc/my.cnf
# , skip-networking ( ) # skip-networking # bind-address=192.168.1.13
######################################################################## # !!! # # mysqld my.cnf # .. # ######################################################################## # # symbolic-links symbolic-links=0 ## , , YMMV skip-name-resolve skip-slave-start skip-external-locking # # # , # sort_buffer_size = 2M read_buffer_size = 2M binlog_cache_size = 1M wait_timeout = 200 interactive_timeout = 300 max_allowed_packet = 12M thread_stack = 128K table_cache = 1024 myisam_sort_buffer_size = 1M tmp_table_size = 12M max_heap_table_size = 12M # # log_queries_not_using_indexes = 1 slow_query_log = 1 slow_query_log_file = /var/lib/mysql/slowquery.log # # tmp_table_size = 12M max_heap_table_size = 12M query_cache_type = 1 query_cache_limit = 2M query_cache_size = 32M max_connections = 500 thread_cache_size = 50 open_files_limit = 65535 table_definition_cache = 4096 table_open_cache = 1024 # MyISAM # key_buffer_size = 32M myisam_recover = FORCE,BACKUP # # max_allowed_packet = 16M max_connect_errors = 1000000 # # log_bin = /var/lib/mysql/mysql-bin expire_logs_days = 14 sync_binlog = 1 # InnoDB # innodb_flush_method = O_DIRECT innodb_log_files_in_group = 2 innodb_log_file_size = 256M innodb_flush_log_at_trx_commit = 1 innodb_file_per_table = 1 innodb_buffer_pool_size = 10G
# chkconfig mysqld on # service mysqld start # service mysqld reload # service mysqld restart
# netstat -tulpn | grep :3306
# vi /etc/sysconfig/iptables
## mysqld web- Apache Lighttpd # -A INPUT -m state --state NEW -s 192.168.1.10 -m tcp -p tcp --dport 3306 -j ACCEPT -A INPUT -m state --state NEW -s 192.168.1.11 -m tcp -p tcp --dport 3306 -j ACCEPT
# service iptables restart
# fs.file-max = 50000 # net.ipv4. ip_local_port_range = 2000 65000
# sysctl -p
# /usr/bin/mysql -u root -h localhost -p
mysql > CREATE DATABASE foo;
mysql > GRANT ALL ON foo.* TO bar@localhost IDENTIFIED BY 'mypassword'; mysql > GRANT ALL ON foo.* TO bar@192.168.1.10 IDENTIFIED BY 'mypassword'; mysql > GRANT ALL ON foo.* TO bar@192.168.1.11 IDENTIFIED BY 'mypassword';
mysql > quit
$ mysql -u bar -h 192.168.1.13 -p'mypassword' foo
$ mysql -u bar -h vm04 -p'mypassword' foo
Source: https://habr.com/ru/post/148077/