rhelt5.4 安装mysql_RedHat5.6 安装mysql

在RHEL系统中,尝试安装MySQL服务器和客户端,遇到文件找不到的错误,通过指定路径成功安装后,需要设置root用户的密码。使用mysqladmin命令重置密码时出现错误,但最终能通过命令行进入MySQL并修改权限。在安装MySQL-embedded时,发现依赖MySQL-devel未解决。文章还提到了查看和修改MySQL用户权限的方法。
摘要由CSDN通过智能技术生成

[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;    可以看到创建表时用到的一些参数

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值