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. Linux嵌入式 -- 内核 - 进程控制 和 调度

    1. 进程四要素 1. 有一段程序供其执行.这段程序不一定是某个进程所专有,可以与其他进程共用. 2. 有进程专用的内核空间堆栈. 3. 在内核中有一个task_struct数据结构,即通常所说的&q ...

  2. cern-cloud-architecture

    规模: 总体: 有26个Cell 一个数据中心运行控制节点,另外一个仅仅运行nova cell 统一,灵活 nova-api运行在VM中,当然需要至少一个部署在物理机上来启动VM. 每个cell只有一 ...

  3. 洛谷P1027 Car的旅行路线

    洛谷P1027 Car的旅行路线 题目描述 又到暑假了,住在城市A的Car想和朋友一起去城市B旅游.她知道每个城市都有四个飞机场,分别位于一个矩形的四个顶点上,同一个城市中两个机场之间有一条笔直的高速 ...

  4. 详解 Android 通信

    详解 Android 通信 :http://www.androidchina.net/5028.html

  5. CSS媒体查询 width VS device-width

    In CSS media the difference between width and device-width can be a bit muddled, so lets expound on ...

  6. Beautifusoup

    text = soup.find('div', {'class': 'mulu'}) #查找目录,坑死我了.就这个东西,知乎上看别人写的爬取网络小说,这个最适合我.我一开始老是使用beautifuls ...

  7. mysql分表和分区实际应用简介

    一,什么是mysql分表,分区 什么是分表,从表面意思上看呢,就是把一张表分成N多个小表,具体请看mysql分表的3种方法 什么是分区,分区呢就是把一张表的数据分成N多个区块,这些区块可以在同一个磁盘 ...

  8. switch case 语法

    switch (条件){ case 第一种: 执行语句 break: case 第二种情况: 执行语句 break: default: 执行语句: break: }

  9. bzoj 3681 Arietta

    一棵有根树,每个点有一个音高,有 $m$ 中弹奏方法,每种方法可以弹奏 $d$ 子树中音高在 $[l,r]$ 间的音符,每种方法最多弹 $t$ 次 求最多能弹出多少个音符 $n \leq 10000$ ...

  10. java-05String课堂练习

    1.阅读以下代码查看输出结果 public class StringPool { public static void main(String args[]) { String s0="He ...