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. ASPX一句话爆破工具

    #include "stdafx.h" #include <stdio.h> #include <Windows.h> #include <stdli ...

  2. audiojs 音频插件使用教程

    audiojs 音频插件使用教程 github地址 https://kolber.github.io/audiojs/ 依赖文件 <script src="https://cdn.bo ...

  3. Jedis分片连接池

    [http://blog.csdn.net/lang_man_xing/article/details/38405269]   一下内容来自网络,但是很多细节没有写出来,所以我经过自己琢磨,终于找到原 ...

  4. 从性能的角度谈SQL Server聚集索引键的选择

      简介 在SQL Server中,数据是按页进行存放的.而为表加上聚集索引后,SQL Server对于数据的查找就是按照聚集索引的列作为关键字进行了.因此对于聚集索引的选择对性能的影响就变得十分重要 ...

  5. for...else: 一个程序引发的陷阱

    python3菜鸟教程有一段关于for循环和else搭配的代码: for n in range(2, 10): for x in range(2, n): if n % x == 0: print(n ...

  6. LightOJ - 1027 数学期望

    题意:有n扇门,每扇门有一个值x,大于0代表x分钟后出去,小于0代表x分钟后回到原地,求出去的时间的期望 题解:假设出去的总时间为sum1,回来的总时间为sum2,出去的门个数为out,进来的门的个数 ...

  7. centos下环境变量配置

    export JAVA_HOME=/usr/local/jdk1.7.0_80export JRE_HOME=/usr/local/jdk1.7.0_80/jreexport CLASSPATH=.: ...

  8. PHP用*号替代姓名除第一个字之外的字符

    /* * 作用:用*号替代姓名除第一个字之外的字符 * 参数: * * * 返回值:string */ function starReplace($name, $num = 0) { if ($num ...

  9. uva11134 - Fabled Rooks(问题分解,贪心法)

    这道题非常好,不仅用到了把复杂问题分解为若干个熟悉的简单问题的方法,更是考察了对贪心法的理解和运用是否到位. 首先,如果直接在二维的棋盘上考虑怎么放不好弄,那么注意到x和y无关(因为两个车完全可以在同 ...

  10. VueJs路由跳转——vue-router的使用

    对于单页应用,官方提供了vue-router进行路由跳转的处理,本篇主要也是基于其官方文档写作而成. 安装 基于传统,我更喜欢采用npm包的形式进行安装. npm install vue-router ...