Linux 用rpm的方式安装mysql(超简单)

参考文档:http://blog.csdn.net/superchanon/article/details/8546254

 RPM安装步骤

a.       检查是否已安装,grep的-i选项表示匹配时忽略大小写

[root@localhost JavaEE]#rpm -qa|grep -i mysql

mysql-libs-5.1.61-4.el6.x86_64

可见已经安装了库文件,应该先卸载,不然会出现覆盖错误。注意卸载时使用了--nodeps选项,忽略了依赖关系:

[root@localhost JavaEE]#rpm -e mysql-libs-5.1.61-4.el6.x86_64 --nodeps

2.     安装MySQL的服务器端软件,注意切换到root用户:

[root@localhost JavaEE]#rpm -ivh MySQL-server-5.5.29-2.el6.x86_64.rpm

安装完成后,安装进程会在Linux中添加一个mysql组,以及属于mysql组的用户mysql。可通过id命令查看:

[root@localhost JavaEE]#id mysql

uid=496(mysql)gid=493(mysql) groups=493(mysql)

MySQL服务器安装之后虽然配置了相关文件,但并没有自动启动mysqld服务,需自行启动:

[root@localhost JavaEE]#service mysql start

Starting MySQL.. SUCCESS!

可通过检查端口是否开启来查看MySQL是否正常启动:

[root@localhost JavaEE]#netstat -anp|grep 3306

tcp        0     0 0.0.0.0:3306               0.0.0.0:*                   LISTEN      34693/mysqld

c.  安装MySQL的客户端软件:

[root@localhost JavaEE]#rpm -ivh MySQL-client-5.5.29-2.el6.x86_64.rpm

如果安装成功应该可以运行mysql命令,注意必须是mysqld服务以及开启:

[root@localhost JavaEE]#mysql

Welcome to the MySQLmonitor.  Commands end with ; or \g.

Your MySQL connection idis 1

Server version: 5.5.29MySQL Community Server (GPL)

Copyright (c) 2000, 2012,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademarkof Oracle Corporation and/or its affiliates. Other names may be trademarks oftheir respective owners.

Type 'help;' or '\h' forhelp. Type '\c' to clear the current input statement.

mysql>

d.  RPM安装方式文件分布

Directory

Contents of Directory

/usr/bin

Client programs and scripts

/usr/sbin

The mysqld server

/var/lib/mysql

Log files, databases

/usr/share/info

Manual in Info format

/usr/share/man

Unix manual pages

/usr/include/mysql

Include (header) files

/usr/lib/mysql

Libraries

/usr/share/mysql

Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation

/usr/share/sql-bench

Benchmarks

 

设置用户名密码:

mysql> select user,host from mysql.user;
+---------+-----------+
| user | host |
+---------+-----------+
| M1234 | % |
....
| root | localhost |
+---------+-----------+
4 rows in set (0.00 sec)

mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;  
mysql> FLUSH PRIVILEGES;  
mysql> quit  

c:> mysql -uroot -p  
Enter password: <输入新设的密码newpassword> 

参考文档:http://blog.csdn.net/feng4656/article/details/9879591

Navicat windowns下远程连接linux端的mysql

我们需要建立到Linux上MySQL服务器的链接,创建一个链接,命名链接名称,填写服务器IP,登录用户和密码,然后进行链接~有可能链接时会出错,说是没有授权,类似于Host '192.168.1.3' is not allowed to connect to this MySQL server的错误~

这个错误原因是没有开放远程链接功能,可以在mysql命名行的客户端中对用户进行授权,例如使用命令GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY ’password’ WITH GRANT OPTION;对root用户进行授权,然后就可以链接成功~

linux mysql更改用户权限

   


参考文档http://www.jb51.net/LINUXjishu/10981.html

ERROR 1045 : Access denied for user root@localhost (using password: YES)


方法一:
# /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>
方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
方法三:
这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!
# mysql -uroot -p
Enter password: <输入/etc/mysql/debian.cnf文件中[client]节提供的密码>
至此,困惑多时的问题解决了! 



http://blog.csdn.net/chunkyo/archive/2006/04/21/671347.aspx,才把问题解决。非常感谢共享资料的技术人员们!

1.#cp /etc/init.d/mysql /etc/init.d/mysql.bak       #拷贝/etc/init.d/mysql到/etc/init.d/mysql.bak文件
2.#/etc/init.d/mysql.bak start                             #执行/etc/init.d/mysql.bak文件启动mysql  成功!!!
3.# rm /etc/init.d/mysql                                     #删除/etc/init.d/mysql文件
4.# mv /etc/init.d/mysql.bak /etc/init.d/mysql  #将/etc/init.d/mysql.bak重命名为/etc/init.d/mysql
5.#/etc/init.d/mysql start                               #执行/etc/init.d/mysql 启动mysql   成功!



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值