linux mysql 安装

 下载地址:http://dev.mysql.com/downloads/mysql/5.6.html#downloads

或者 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz



tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql


groupadd mysql

useradd -g taizhen mysql


------------

cd /usr/local/mysql 

mkdir ./data/mysql

chown -R mysql:mysql ./

./scripts/mysql_install_db  --datadir=/usr/local/mysql/data/mysql (这里可能会遇到问题啊)

1.The server quit without updating PID file 

这是因为上步执行 db 没有成功。

2.sqld_safe mysqld from pid file /usr/local/mysql/mysql-5.6.33-linux-glibc2.5-x86_6 4/data/mysql/izm5e

yum install -y perl-Module-Install.noarch

3. libaio.so.1: cannot open shared object file  

sudo apt-get install libaio1  


cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf




对应启动mysql 要注意内存的分配。

#修改启动脚本
vi  /etc/init .d /mysqld
 
#修改项:
basedir= /usr/local/mysql/
datadir= /usr/local/mysql/data/mysql
 
#启动服务
service mysqld start
 
#测试连接
. /mysql/bin/mysql  -uroot
 
#加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了
export  PATH=$PATH: /usr/local/mysql//bin <br> source  /etc/profile
 
 
#启动mysql
service mysqld start
#关闭mysql
service mysqld stop
#查看运行状态
service mysqld status

mysql 设置root 密码:  mysqladmin -u root password

mysql 设置对外可以root访问: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '这里填你的mysql root 密码' WITH GRANT OPTION;

mysql 一些配置

#mysqladmin = /usr/local/mysql/bin/mysqladmin
#mysqld     = /usr/local/mysql/bin/mysqld_safe
[mysqld1]

innodb_force_recovery=0
port=3306
skip-name-resolve
datadir=/data/mysql_mall
tmpdir=/data/mysql_mall/tmpdir
socket=/var/lib/mysql/mysql_mall.sock
pid-file=/data/mysql_mall/3306.pid
log-error=/data/mysql_mall/3306.log
#default-storage-engine=InnoDB
symbolic-links=0
max_connections=3000
max_connect_errors=99999
wait_timeout=28800
interactive_timeout=28800
performance_schema=0
query_cache_size=0
query_cache_type=0
max_allowed_packet=64M
max_heap_table_size=128M
tmp_table_size=256M
max_length_for_sort_data=16k
net_buffer_length=8K
read_buffer_size=2M
read_rnd_buffer_size=1M
sort_buffer_size=8M
join_buffer_size=8M
table_open_cache=1024
thread_cache_size=128
skip_external_locking
performance_schema_max_table_instances=200
table_definition_cache=400
table_open_cache=128


lower_case_table_names=1
slow_query_log
slow_query_log_file=/data/mysql_mall/log/slow-query.log

long_query_time=1
log_warnings=1




binlog_cache_size=1M
max_binlog_size=512M
expire_logs_days=1
binlog_format=ROW
sync_binlog=0
key_buffer_size = 256M




log-bin=/data/mysql_mall/binlog/master-bin
log-bin-index=/data/mysql_mall/binlog/master-bin.index


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值