1:下载mysql
wget http://downloads.mysql.com/archives/mysql-5.6/mysql-5.6.9-rc-linux-glibc2.5-x86_64.tar.gz
2:解压
[root@redhat tmp]# tar -zxvf mysql-5.6.9-rc-linux-glibc2.5-x86_64.tar.gz
[root@redhat tmp]# mv mysql-5.6.9-rc-linux-glibc2.5-x86_64 /usr/local/mysql
[root@redhat mysql]# pwd
/usr/local/mysql
3:创建mysql用户,用户组,授权
[root@redhat mysql]# groupadd mysql
[root@redhat mysql]# useradd mysql -g mysql
[root@redhat mysql]# chown -R root .
[root@redhat mysql]# chown -R mysql data
[root@redhat mysql]# chown -R mysql data/mysql/.
[root@redhat mysql]# chgrp -R mysql .
[root@redhat mysql]# cp ./support-files/my-medium.cnf /etc/my.cnf
[root@redhat mysql]# ./scripts/mysql_install_db --user=mysql
4:登录到msyql
[root@redhat mysql]# bin/mysqld
5:创建登录密码(三种方法)
1.用root 进入mysql后
mysql>set password =password('你的密码');
mysql>flush privileges;
2.使用GRANT语句
mysql>grant all on *.* to 'root'@'localhost' IDENTIFIED BY '你的密码'with grant option ;
mysql>flush privileges;
3.进入mysql库修改user表
mysql>use mysql;
mysql>update user set password=password('你的密码') where user='root';
mysql>flush privileges;
6:启动mysql服务
[root@redhat mysql]# bin/mysqld_safe --user=mysql &
7:启动mysql客户端
[root@redhat mysql]# bin/mysql -uroot -p
------------------------------------------------------------------------------
出现提示:error no. 1045 access denied for user 'root'@'*****' (using password:YES)。
这个是由于访问的ip没有权限
在服务器上通过命令行登录 mysql,然后输入命令语句:
grant all on *.* to 'root'@'计算机名' identified by '密码';
flush privileges;
让所有的IP都有权限
grant all on *.* to 'root'@'%' identified by '密码';