1,mysql安装包下载,按路径下载解压即可。
2,若打开mysql失败,提示缺少msvcr120、dll文件,需要下载微软镜像
3,MYSQL环境变量配置:3、1,找到mysql解压后bin目录。3、2,在系统属性点击环境变量。3、3,在环境变量,编辑Path路径。3、4,在环境变量输入mysql安装目录bin路径即可(1)中路径
4,MYSQL安装与登录:4、1以管理员身份启动命令提示符,并定位到MYSQL安装目录bin路径下。4、2执行命令mysqld-install和mysqld--initialize。4、3上述命令执行完,会在mysql安装路径出现data文件夹。在data文件夹中有一个以、err结尾的文件,记录mysql初始密码。4、4执行netstartmysql启动mysql服务。4、5使用历史密码,登录mysql服务mysql-uroot-p密码为、err文件记录密码。4、6修改root用户登录密码。
1、解压缩,比如到d:\,为了方便,改一下路径,比如mysql2、开始/运行,输入cmd,回车进入命令行d:cd mysql\bin
安装mysql服务
mysqld.exe --install (默认服务名称是mysql或者mysqld.exe --install "mysql5"修改服务名称)
删除mysql服务
mysqld.exe --remove(或者mysqld.exe --remove "mysql5")
3、ini参数配置文件d:\mysql\
复制mysql-small.ini为my.ini
4、启动停止服务
a)在命令行启动/停止
net start mysql
net stop mysql
b)或者去控制面板找服务启动
c)或者开始/运行输入services.msc,确定后,找到mysql启动
shell>groupadd mysqlshell>useradd -r -g mysql mysql
shell>cd /usr/local
shell>tar zxvf mysql-5.5.32-linux2.6-x86_64.tar.gz
shell>mv mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql3309
shell>cd /usr/local/mysql3309
shell>chown -R mysql .
shell>chgrp -R mysql .
2
shell>cat my3309.cnf
#/usr/local/mysql3309下新建my3309.cnf配置文件,内容复制my3308.cnf
shell>mkdir /usr/local/mysql3309/logs
shell>mkdir /usr/local/mysql3309/bin-log
shell>chown -R mysql.mysql .
shell>scripts/mysql_install_db --user=mysql --defaults-file=/usr/local/mysql3309/my3309.cnf
-----------------------my3309.cnf内容--------------------------------------
[client]
#password = your_password
port = 3307
socket = /tmp/mysql3307.sock
[mysql]
socket = /tmp/mysql3307.sock
# The MySQL server
[mysqld]
port = 3309
socket = /tmp/mysql3307.sock
basedir =/usr/local/mysql3307
datadir =/usr/local/mysql3307/data
skip-external-locking
skip-host-cache
skip-name-resolve
max_connection =1000
key_buffer_size = 600M
max_allowed_packet = 10M
table_open_cache = 1024
sort_buffer_size = 6M
read_buffer_size = 6M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 64
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
log-error=/usr/local/mysql3307/logs/mysqld3307.log
server-id = 1
log_slave_updates = 1
auto_increment_increment=2
auto_increment_offset=2
read-only
log_bin =/usr/local/mysql3307/binlog/mysql-bin.log
#log-bin-index= mysql-bin.index
max_binlog_size =1G
max_relay_log_size =1G
expire_logs_days = 30 #超过30天的binlog删除
replicate-do-db =test #只复制某个库
replicate-do-db =fab
replicate-do-db =fat
replicate-do-db =thca
replicate-do-db =fab_innodb
replicate-ignore-db=mysql #不复制某个库
3
(启动mysql)
shell>bin/mysqld_safe --defaults-file=/usr/local/mysql3309/my3309.cnf --user=mysql >/dev/null 2>&1 &
(进入mysql)
shell>bin/mysql --defaults-file=/usr/local/mysql3309/my3309.cnf
4
无法启动或进入:
查看日志shell>tail -f /usr/local/mysql3309/logs/mysql3309.log
END
注意事项
解压缩版的mysql可直接运行,执行时需指定my.cnf文件
注意添加--defaults-file=/usr/local/my3309.cnf命令
由于在my.cnf文件中指定了mysql.sock的位置,为了避免多个mysql同时读取/tmp/mysql.sock文件,在启动时指定读取的sock文件位置: --socket=/tmp/mysql3307.sock
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)