1.下载mysql rpm包

在该网站选择相应的包 http://dev.mysql.com/downloads/mysql/5.0.html

这里选择:MySQL-server-5.6.17-1.sles11.x86_64.rpm 和 MySQL-client-5.6.17-1.sles11.x86_64.rpm

安装这两个包,执行 rpm -ivh MySQL-server-5.6.17-1.sles11.x86_64.rpm

rpm -ivh MySQL-client-5.6.17-1.sles11.x86_64.rpm

2.启动mysql

/etc/init.d/mysql start

3.连接mysql

  1. [root@localhost bin]# ./mysql -uroot -p12345
  2. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

遇到上面情况怎么办,请按如下步骤操作:

1、停止mysql服务

  1. [root@localhost bin]# chkconfig --list | grep -i mysql
  2. mysql           0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭
  3. [root@localhost bin]# service mysql stop
  4. Shutting down MySQL                                        [确定]

2、用mysqld_safe重启服务

  1. [root@localhost bin]# ./mysqld_safe --user=root --skip-grant-tables --skip-networking &
  2. [1] 3818
  3. [root@localhost bin]# 111105 07:30:32 mysqld_safe Logging to '/usr/local/mysql/var/localhost.localdomain.err'.
  4. 111105 07:30:32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
  5. ./mysql -uroot mysql
  6. Welcome to the MySQL monitor.  Commands end with ; or \g.
  7. Your MySQL connection id is 1
  8. Server version: 5.1.48-log Source distribution
  9. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  10. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  11. and you are welcome to modify and redistribute it under the GPL v2 license
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

3、重设密码

  1. mysql> update user set password=password('12345') where user='root' ;
  2. Query OK, 3 rows affected (0.05 sec)
  3. Rows matched: 3  Changed: 3  Warnings: 0
  4. mysql> flush privileges;
  5. Query OK, 0 rows affected (0.00 sec)
  6. mysql> quit
  7. Bye

4、重启服务

  1. [root@localhost bin]#service mysql stop
  2. [root@localhost bin]# service mysql start

5、再次连接数据库

    1. [root@localhost bin]# ./mysql -uroot -p12345
    2. Welcome to the MySQL monitor.  Commands end with ; or \g.
    3. Your MySQL connection id is 1
    4. Server version: 5.1.48-log Source distribution
    5. Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    6. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    7. and you are welcome to modify and redistribute it under the GPL v2 license
    8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

--------------------------------------------------------------------------------------------------

增加MySQL用户,使之可以远程连接

  格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
例1、增加一个用户user_1密码为123,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MySQL,然后键入以下命令:

  mysql> grant select,insert,update,delete on *.* to user_1@"%" Identified by "123";
例1增加的用户是十分危险的,如果知道了user_1的密码,那么他就可以在网上的任何一台电脑上登录你的MySQL数据库并对你的数据为所欲为了,解决办法见例2。

  例2、增加一个用户user_2密码为123,让此用户只可以在localhost上登录,并可以对数据库aaa进行查询、插入、修改、删除的 操作(localhost指本地主机,即MySQL数据库所在的那台主机),这样用户即使用知道user_2的密码,他也无法从网上直接访问数据库,只能 通过MYSQL主机来操作aaa库。

  mysql>grant select,insert,update,delete on aaa.* to user_2@localhost identified by "123";

  用新增的用户如果登录不了MySQL,在登录时用如下命令:

  mysql -u user_1 -p -h 192.168.113.50 (-h后跟的是要登录主机的ip地址)

SUSE 安装mysql的更多相关文章

  1. 安装MySQL -- SuSE Linux Enterprise Server 11 SP3

    1.准备工作从MySQL官网上分别下载mysql服务器端于客户端包: MySQL-server-5.5.49-1.sles11.x86.rpm MySQL-client-5.5.49-1.sles11 ...

  2. SUSE Linux源代码编译安装MySQL 5.6

    这篇文章主要介绍了SUSE Linux下源代码编译方式安装MySQL 5.6过程分享,本文使用SUSE Linux Enterprise Server 10 SP3 (x86_64)系统,须要的朋友能 ...

  3. 数据库(一):suse下MySQL安装

    1.准备工作从MySQL官网上分别下载mysql服务器端于客户端包:MySQL-server-5.5.31-1.linux2.6.x86_64.rpmMySQL-client-5.5.31-1.lin ...

  4. lnmp安装--linux通过tar.gz源码包安装mysql

    mysql版本:5.6 [http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz] [http://dev.mysql.com/get ...

  5. Linux下基于源代码方式安装MySQL 5.6

    MySQL为开源数据库,因此能够基于源代码实现安装.基于源代码安装有很多其它的灵活性. 也就是说我们能够针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码.依据不同的软件平台环境调整相关的编译 ...

  6. Java全栈程序员之04:Ubuntu下安装MySQL、注册服务及Navcat

    在安装MySQL之前,我们先来介绍一下Ubuntu下软件的安装方式.首先回顾下,我们安装JDK,使用的是后缀名为tar.gz的安装包.安装idea,使用的是tar.gz:那有没有别的安装方式呢? 1. ...

  7. 在SuSE安装wifidog认证服务器和网关

    在SuSE安装认证服务器和网关 在openSuSE 10.3安装wifidog 认证服务器和网关在同台设备中安装完毕.以下是openSuSE的详细安装指南.这个安装是非常初级的,所以请验证或更正. - ...

  8. Centos6.5下编译安装mysql 5.6

    一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm -e mysql //普通删除模式 rpm -e ...

  9. 在Ubuntu 16.10安装mysql workbench报未安装软件包 libpng12-0错误

    1.安装mysql workbench,提示未安装软件包 libpng12-0 下载了MySQL Workbench 6.3.8   在安装的时候报错: -1ubu1604-amd64.deb 提示: ...

随机推荐

  1. Google Chrome 未响应。是否立即重新启动?

    不当的退出会造成 Google Chrome 无法启动.出现“Google Chrome 未响应.是否立即重新启动?”的错误.要解决这个问题:      1.同时按住Windows旗帜键 + R键,调 ...

  2. HDU 3473 Minimum Sum (划分树求区间第k大带求和)(转)

    题意:在区间中找一个数,求出该区间每个数与这个数距离的总和,使其最小 找的数字是中位数(若是偶数个,则中间随便哪个都可)接着找到该区间比此数大的数的总和 区间中位数可以使用划分树,然后在其中记录:每层 ...

  3. HDU 6096 AC自动机

    n个字符串 m个询问 每个询问给出前后缀 并且不重合 问有多少个满足 m挺大 如果在线只能考虑logn的算法 官方题解:对n个串分别存正序倒序 分别按照字典序sort 每一个串就可以被化作一个点 那么 ...

  4. VC SOCKET 压缩通信学习

    Server................// Server.cpp : Defines the entry point for the console application. // #inclu ...

  5. OpenStack for NFV applications: enabling Single Root I/O virtualization and PCI-Passthrough

    http://superuser.openstack.org/articles/openstack-for-nfv-applications-enabling-single-root-i-o-virt ...

  6. js命令模式

    命令模式(Command),将一个请求封装为一个对象,从而使你可用不同的请求对客户进行参数化:对请求排队或记录请求日志,以及支持可撤销的操作. 从命令模式的结构图可以看出,它涉及到五个角色,它们分别是 ...

  7. C++中int转string与string转int

    #include "stdafx.h" #include "string" #include "iostream" #include &qu ...

  8. Mysql 高级部分

    MySQL 高级部分   (1)索引(index)..................................................................... 1 (2) ...

  9. 倒置字符串函数reverse

    倒置字符串函数reverse:用于倒置字符串s中的各个字符的位置, 如原来字符串中如果初始值为123456,则通过reverse函数可将其倒置为654321, 程序如下: #include<st ...

  10. IIS 高并发的相关配置

    前言: 随着业务量的增加,服务器流量的增长增长了好多,高峰期会出现 503 的错误,IIS 对请求数的配置默认是 1000,无法满足现状的需求: 需要收集性能数据如下: 1.Windows性能监视器, ...