CentOS 5.6 MySQL远程访问设置(无需密码)(二)

2014-11-24 18:51:25 · 作者: · 浏览: 2
ting to
# the master - required
#master-password =
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port =
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin



# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname



# Uncomment the following if you are using BDB tables
#bdb_cache_size = 384M
#bdb_max_lock = 100000



# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50



[mysqldump]
quick
max_allowed_packet = 16M



[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates



[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M



[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M



[mysqlhotcopy]
interactive-timeout


三 、修改mysql权限


进入mysql数据库


GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION//赋予任何主机访问数据的权限这里需要重启,否则会出现错误!OK!四、测试这里被访问的数据库IP地址为192.168.149.96,我用ip为192.168.149.155的机器访问数据库mysql -u root -h 192.168.149.96 -p
(注:这里IP为192.168.149.155上mysql数据库也需要安装好,否则会提示无法连接)进入数据库后检查访问的数据是否与192.168.149.96上的数据一致,要是一致,则设置成功!