mysql的安装 (tar包)

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 '密码';

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值