linux系统Mysql5.6下载与安装

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/  #加这里

你可能感兴趣的:(数据库)