linux系统Mysql5.6下载与安装

本文档提供MySQL5.6在Linux系统的下载地址和安装步骤,包括从wget下载压缩包到安装过程中的配置调整,特别是解决datadir配置错误的问题。
1、下载地址 wget http://downloads.mysql.com/archives/get/file/mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz


2、安装说明 http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html
3、安装步骤:
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
4、安装完成后,设置root密码(安装很多遍,一直没仔细看过这个说明)
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'


Alternatively you can run:


  ./bin/mysql_secure_installation


which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:


  cd . ; ./bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl


  cd mysql-test ; perl mysql-test-run.pl
提示mysql命令不存在:ln -s /usr/local/mysql/bin/mysql /usr/bin
5、安装后,用/usr/local/mysql/bin/mysql -u root -p 进入报错
/usr/local/mysql/bin/mysql: unknown variable 'datadir=/data1/mysql/var/' 
这里需要修改my.cnf  配置问题 :
[client]
#password        = your_password
port                = 3306
socket                = /tmp/mysql.sock
datadir         = /data1/mysql/var/  #把这里已到下方mysqld部分里

[mysqld]
port                = 3306
socket                = /tmp/mysql.sock
datadir         = /data1/mysql/var/  #加这里
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值