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. JavaScript -- 正则表达式 检验表单提交的内容

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Spring data jpa 实现简单动态查询的通用Specification方法

    本篇前提: SpringBoot中使用Spring Data Jpa 实现简单的动态查询的两种方法 这篇文章中的第二种方法 实现Specification 这块的方法 只适用于一个对象针对某一个固定字 ...

  3. Springboot- Caused by: org.hibernate.AnnotationException: No identifier specified for entity:

    错误与异常: Caused by: org.hibernate.AnnotationException: No identifier specified for entity: 原因:引用了不对的包, ...

  4. Linux开放端口

    开放端口8081 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT 重启端口服务 ser ...

  5. mysql插入一万条数据

    定义一个存储过程 mysql> delimiter $$ mysql> create procedure ptest()    -> begin    -> declare p ...

  6. 利用wtl的CDialogResize自动调整atl ActiveX控件布局

    前言 利用atl 开发activex控件时,如果使用atl复合控件时,acitvex控件上的界面元素不会自动改变大小,如果自己在OnSize中处理每个子控件的布局是一件非常麻烦的事,我们可以借助wtl ...

  7. 2018.7.27 wireless charger TX evaluation kit based on STWBC-EP

    1 introduced 我们需要设计一个无线充电方案: 功能需求:通用的无线充电平台 参数要求:8-10W step1: 找寻资料  http://www.ti.com/sitesearch/doc ...

  8. cmake安装MySQL数据库实例

    一.编译安装MySQL前的准备工作 首先检查是否有安装其他版本的编译器和数据库,先卸载干净. 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel p ...

  9. stl_algo.h

    stl_algo.h // Filename: <stl_algo.h> // Comment By: 凝霜 // E-mail: mdl2009@vip.qq.com // Blog: ...

  10. eShopOnWeb

    eShopOnWeb https://www.cnblogs.com/sheng-jie/p/9616675.html 构建现代Web应用 1.引言 eShopOnWeb是基于ASP.NET Core ...