日期:2014-05-16 浏览次数:20985 次
一、非root用户安装二进制mysql分发版
创建用户
>useradd fc
>passwd fc
enter password:
...
以fc登录,上传二进制mysql版本,我的是mysql 32位的mysql-5.1.57-linux-i686-glibc23.tar.gz
解压后,创建权限表
]$ scripts/mysql_install_db --basedir=/home/fc/app/mysql --datadir=/home/fc/app/mysql/data/3307 --user=fc
(注意:后面的参数一定要指定 ,另外最好是 scripts/mysql_install_db 这样一起运行,官方文档也是这样,免得出错,后面就有这个原因导致启动出错的)
权限表也初始化完了,然后就是指定配置文件my.cnf 我放在$HOME目录下:
# Example MySQL config file for medium systems. # # This is for a system with little memory (32M - 64M) where MySQL plays # an important part, or systems up to 128M where MySQL is used together with # other programs (such as a web server) # # MySQL programs look for option files in a set of # locations which depend on the deployment platform. # You can copy this option file to one of those # locations. For information about these locations, see: # http://dev.mysql.com/doc/mysql/en/option-files.html # # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the "--help" option. # The following options will be passed to all MySQL clients [client] #password = your_password port = 3307 socket = /home/fc/app/mysql/tmp/3307/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] character-set-server = utf8 port = 3307 socket = /home/fc/app/mysql/tmp/3307/mysql.sock skip-external-locking basedir = /home/fc/app/mysql datadir = /home/fc/app/mysql/data/3307/ log-error = /home/fc/log/3307/mysqld.err pid-file = /home/fc/app/mysql/tmp/3307/mysql.pid key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M max_connections=200 slow_query_log = 1 #{0|1 off|on} slow_query_log_file = /home/fc/log/3307/mysql-slow.log long_query_time=1 #不经常更新的表查询,缓存查询 query_cache_type = 1 query_cache_size = 10M general_log = 0 general_log_file = /home/fc/log/3307/mysql.log query_cache_size = 8M #skip-networking skip-name-resolve skip-innodb-checksums # Replication Master Server (default) # binary logging is required for replication log-bin=/home/fc/log/3307/mysql-bin # binary logging format - mixed recommended binlog_format=mixed binlog_cache_size = 1M max_binlog_cache_size = 4096M expire-logs-days = 8 sync_binlog=20 # Uncomment the following if you are using InnoDB tables innodb_data_home_dir = /home/fc/data/3307/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /home/fc/data/3307/ innodb_buffer_pool_size = 800M sort_buffer_size = 5M tmp_table_size = 64M innodb_additional_mem_pool_size = 32M innodb_autoextend_increment = 64 # 默认单位为 MB innodb_thread_concurrency = 8 innodb_log_file_size = 200M innodb_log_buffer_size = 8M default-storage-engine=innodb innodb_flush_log_at_trx_commit = 1 # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 innodb_flush_log_at_trx_commit = 2 [mysqldump] quick max_allowed_packet = 16M [mysqld_safe] log-error=/home/fc/app/mysql/log/3307/mysqld.log pid-file=/home/fc/app/mysql/tmp/3307/mysql.pid [mysql] no-auto-rehash port = 3307 socket = /home/fc/app/mysql/tmp/3307/mysql.sock # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout
二、启动mysqld进程
进入basedir目录fc/app/mysql
mysql]$ cd bin