aws上redhat安装lmysql服务记

aws上redhat安装lmysql服务记

 

1.准备材料

 

1.1

本文是mysql5.5,上传两个文件到服务器

 

2.安装过程

2.1首先安装服务端

 rpm -ivh MySQL-server-5.5.50-1.linux2.6.x86_64.rpm

出现如下问题

说明包冲突了,服务器已经有了这个包,要先把他卸载,输入

rpm -e --nodeps mariadb-libs-1:5.5.*

再次rpm安装,这次显示

说明已经成功。

 

2.2安装客户端

rpm -ivh MySQL-client-5.5.50-1.linux2.6.x86_64.rpm 

显示如下说明成功

 

3.查看是否成功

ps -ef|grep mysqld

出现如上说明还没启动,启动一下mysql

# /etc/init.d/mysql start

 

 

4.登录mysql

第一次登录只需键入mysql

[root@gc01vm4 init.d]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

 

出现如上提示刚表示登录成功

 

修改root密码

 

增加了密码后的登录格式如下:

mysql -u root -p
   Enter password: (你自己设的密码)
   其中-u后跟的是用户名,-p要求输入密码,回车后在输入密码处输入密码。

 

额:

1.登录MySQL
   登录MySQL的命令是mysql, mysql 的使用语法如下:
   mysql [-u username] [-h host] [-p[password]] [dbname]
    username 与 password 分别是 MySQL 的用户名与密码,mysql的初始管理帐号是root,没有密码,注意:这个root用户不是Linux的系统用户。MySQL默认用户是root,由于 初始没有密码,第一次进时只需键入mysql即可。
   [root@test1 local]# mysql
   Welcome to the MySQL monitor. Commands end with ; or \g.
   Your MySQL connection id is 1 to server version: 4.0.16-standard
   Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
   mysql>
   出现了“mysql>”提示符,]
这说明你安装是成功的。

2.MySQL默认没有密码,安装完毕增加密码的重要性是不言而喻的。
   1、命令
   usr/bin/mysqladmin -u root password 'new-password'
   格式:mysqladmin -u用户名 -p旧密码 password 新密码
   2、例子
   例1:给root加个密码123456。
   键入以下命令 :
   [root@test1 local]# /usr/bin/mysqladmin -u root password 123456
   注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。
3.增加了密码后的登录格式如下:
   mysql -u root -p
   Enter password: (你自己设的密码)
   其中-u后跟的是用户名,-p要求输入密码,回车后在输入密码处输入密码。
4.到这儿就基本OK,可以顺利进入mysql 

 

 

5.远程登录

 

使用sqlyog登录,发现

 

原来安装好mysql默认不放开外网ip登录,修改权限

grant all privileges on *.* to 'root'@'%' identified by '654321' with grant option;

其中 第一个*表示数据库名;第二个*表示该数据库的表名;如果像上面那样 *.*的话表示所有到数据库下到所有表都允许访问;

‘%’:表示允许访问到mysql的ip地址;当然你也可以配置为具体到ip名称;%表示所有ip均可以访问;

后面到‘654321’为root 用户的password

 

成功。

 

 

 

6.其他问题

1.

 

posted @ 2016-07-28 10:35  crazyYong  阅读(673)  评论(0编辑  收藏  举报