• RedHat5.6 安装mysql


    [root@server01 ~]#rpm -qa | grep -i mysql
    [root@server01 ~]#ls /home/oracle
    app jdk-7u9-linux-i586.rpm MySQL-server-5.5.28-1.rhel5.i386.rpm
    CollabNetSubversionEdge-3.0.0_linux-x86.tar.gz MySQL-client-5.5.28-1.rhel5.i386.rpm oraInventory
    [root@server01 ~]#rpm -ivh MySQL-server-5.5.28-1.rhel5.i386.rpm
    error: open of MySQL-server-5.5.28-1.rhel5.i386.rpm failed: 没有那个文件或目录
    [root@server01 ~]#rpm -ivh /home/oracle/MySQL-server-5.5.28-1.rhel5.i386.rpm
    Preparing... ########################################### [100%]
    1:MySQL-server ########################################### [100%]

    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:

    /usr/bin/mysqladmin -u root password 'new-password'
    /usr/bin/mysqladmin -u root -h tffserver01 password 'new-password'

    Alternatively you can run:
    /usr/bin/mysql_secure_installation

    which will also give you the option of removing the test
    databases and anonymous user created by default. This is
    strongly recommended for production servers.

    See the manual for more instructions.

    Please report any problems with the /usr/bin/mysqlbug script!

    [root@server01 ~]#rpm -ivh /home/oracle/MySQL-client-5.5.28-1.rhel5.i386.rpm
    Preparing... ########################################### [100%]
    1:MySQL-client ########################################### [100%]
    [root@server01 ~]#mysql -uroot
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    [root@server01 ~]#service mysql start
    Starting MySQL....... [确定]
    [root@server01 ~]#mysql -uroot
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.5.28 MySQL Community Server (GPL)

    Copyright (c) 2000, 2012, 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> show user;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user' at line 1
    mysql> exit
    Bye
    [root@server01 ~]#usr/bin/mysqladmin -u root password 'mysql'
    -bash: usr/bin/mysqladmin: 没有那个文件或目录
    [root@server01 ~]#/usr/bin/mysqladmin -u root password 'mysql'
    [root@server01 ~]#mysql -uroot
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    [root@server01 ~]#mysql -uroot -pmysql
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 4
    Server version: 5.5.28 MySQL Community Server (GPL)

    Copyright (c) 2000, 2012, 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> exit
    Bye
    [root@server01 ~]#mysql -uroot -pmysql
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 7
    Server version: 5.5.28 MySQL Community Server (GPL)

    Copyright (c) 2000, 2012, 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> grant all privileges on *.* to 'root'@'192.168.1.11' identified by 'mysql' with grant option;
    Query OK, 0 rows affected (0.07 sec)

    mysql> exit
    Bye

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

    [root@server01 Server]#rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
    warning: perl-DBI-1.52-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
    Preparing... ########################################### [100%]
    1:perl-DBI ########################################### [100%]
    [root@server01 Server]#rpm -ivh mysql-5.0.77-4.el5_5.4.i386.rpm
    warning: mysql-5.0.77-4.el5_5.4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
    Preparing... ########################################### [100%]
    1:mysql ########################################### [100%]
    [root@server01 Server]#rpm -ivh mysql-devel-5.0.77-4.el5_5.4.i386.rpm
    warning: mysql-devel-5.0.77-4.el5_5.4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
    Preparing... ########################################### [100%]
    1:mysql-devel ########################################### [100%]
    [root@server01 Server]#rpm -ivh /home/oracle/MySQL-embedded-5.5.28-1.rhel5.i386.rpm
    error: Failed dependencies:
    MySQL-devel is needed by MySQL-embedded-5.5.28-1.rhel5.i386

    安装MySQL-embedded-5.5.28-1.rhel5.i386时需要解决依赖问题...

    ***********************************************************************************

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题解决:转载自Linux中文站. http://www.linux265.com/blog/index.php/archives/474

    登录mysql时报以上错误,解决方法如下:重置密码 mysqladmin -uroot -p password 'newpassword'

    # /etc/init.d/mysql stop
    # mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    # mysql -u root mysql
    mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    # /etc/init.d/mysql restart
    # mysql -uroot -p
    Enter password: < 输入新设的密码newpassword>
    
    mysql>

    如果可以用navicat工具连过去,查看用户权限,修改用户权限都是很方便的,但很多时候MySQL都是只允许localhost访问,这时就只能用命令了

    以前用
    mysql> select * from mysql.user where user='username';

    今天发现这个更方便:
    mysql> show grants for username@localhost;   或mysql> show grants for root@'localhost'; 或mysql> show grants for root@'%'; 或mysql> show grants;

    show可以看到很多东西
    show create database dbname;  这个可以看到创建数据库时用到的一些参数。
    show create table tickets;    可以看到创建表时用到的一些参数

  • 相关阅读:
    chkconfig命令
    Office 2010 与搜狗输入法兼容问题
    【转】WAS入门简介
    UTF8GB2312GBK
    System.getProperty
    Hibernate 事务方法保存clob类型数据
    Eclipse 或者 Myeclipse 提示选择工作空间设置
    request
    那些操蛋的人生
    Java新手入门很重要的几个基本概念
  • 原文地址:https://www.cnblogs.com/totozlj/p/2770341.html
Copyright © 2020-2023  润新知