当前位置:文档之家› mysql--linux安装文档

mysql--linux安装文档

1首先查看是否已经装有mysql命令:rpm –qa|grep –i mysql如果有的话,用命令卸载(删除)命令:rpm –e --nodeps 包名2.上传安装文件MySQL-client-5.5.8-1.rhel5.i386.rpmMySQL-server-5.5.8-1.rhel4.i386.rpm运行命令安装:rpm –ivh MySQL-server-5.5.8-1.rhel4.i386.rpm成功界面:[root@localhost liuhaisheng]# rpm -ivhMySQL-server-5.5.8-1.rhel4.i386.rpmPreparing...########################################### [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 localhost.localdomain password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich 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!3.安装客户端[root@localhost liuhaisheng]# rpm -ivhMySQL-client-5.5.8-1.rhel5.i386.rpmPreparing...########################################### [100%]1:MySQL-client########################################### [100%][root@localhost liuhaisheng]#4 检查安装是否成功[root@localhost liuhaisheng]# MySQLbash: MySQL: command not found[root@localhost liuhaisheng]# mysqlERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)[root@localhost liuhaisheng]# cd ..[root@localhost /]# cd ..[root@localhost /]# chown -R mysql:mysql /var/lib/mysql[root@localhost /]# /etc/init.d/mysqld startbash: /etc/init.d/mysqld: 没有那个文件或目录[root@localhost /]# /etc/init.d/mysql startStarting MySQL.. [确定] [root@localhost /]# cd /usr/bin[root@localhost bin]# mysqladmin -uroot password '123456'[root@localhost bin]# mysqladmin -u root password '521125'增加了密码后的登录格式如下:MySQL -u root -pEnter password: (输入密码)其中-u后跟的是用户名,-p要求输入密码,回车后在输入密码处输入密码。

注意:这个MySQL文件在/usr/bin目录下,与后面讲的启动文件/etc/init.d/MySQL不是一个文件。

[root@localhost bin]# mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.5.8 MySQL Community Server (GPL)Copyright (c) 2000, 2010, 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>5 mysql的卸载linux下MySQL卸载方法一.源码安装的卸载方法:到源码目录,如果可以运行make uninstall就可以卸载。

如果没有,就直接删除。

如果是./configure --prefix指定了目录用 rm -rf 目录名删除-------------------------------------------------------------[root@localhost ~]# cd /usr/local/src/mysql-5.1.45[root@localhost mysql-5.1.45]# make uninstall[root@localhost mysql-5.1.45]# cd ..[root@localhost src]# rm -rf mysql-5.1.45[root@localhost src]# cd ..[root@localhost local]# lsbin etc games include lib libexec mysql sbin share src web[root@localhost local]# rm -rf mysql/[root@localhost local]# lsbin etc games include lib libexec sbin share src web[root@localhost local]#-------------------------------------------------------------二.rpm方式安装的卸载方法:查看是否安装mysql的命令rpm -qa | grep mysql然后逐个使用 rpm -e mysq-* 卸载如果出现error: Failed dependencies:libmysqlclient.so.10 is needed by (installed)libdbi-dbd-mysql-0.6.5-10.RHEL4.1.i386libmysqlclient.so.10 is needed by (installed)MySQL-python-1.0.0-1.RHEL4.1.i386libmysqlclient.so.10 is needed by (installed)MyODBC-2.50.39-21.RHEL4.1.i386libmysqlclient.so.10 is needed by (installed) qt-MySQL-3.3.3-9.3.i386 mysqlclient10 is needed by (installed)MySQL-python-1.0.0-1.RHEL4.1.i386mysqlclient10 = 3.23.58-4.RHEL4.1 is needed by (installed) mysqlclient10-devel-3.23.58-4.RHEL4.1.i386时,使用 --nodeps 参数,如:rpm -e mysqlclient10-devel-3.23.58-4.RHEL4.1 --nodepsrpm -e mysqlclient10-3.23.58-4.RHEL4.1 --nodeps网络其他记录:本人未验证启动MySQL/etc/init.d/MySQL start 或service MySQL start停止MySQL/etc/init.d/MySQL stop 或service MySQL stop到此,MySQL服务就安装配置完成。

安装MySQL客户端rpm -ivh MySQL-client-4.0.14-0.i386.rpmMySQL安装好后目录结构如下:工具程序在/usr/bin目录中---ls /usr/bin/MySQL*服务器程序/usr/sbin/MySQLd数据目录/var/lib/MySQL默认情况下MySQL将错误日志文件、二进制日志文件及进程文件写在/var/lib/MySQL目录中,如localhost.err、localhost.pid、localhost-bin.001等要改变这些情况可以修改/etc/f文件如将日志文件写在/var/log目录中,可以在f文件中加入下面两行:[MySQLd_safe]err-log = /var/log/MySQLd.log有个实用程序/usr/bin/MySQL_install_db,该程序可以用来初始化MySQL数据库,即创建/var/l og/MySQL目录,及创建MySQL数据库(MySQL授权表等信息)及test数据库(空库),如果不小心删除了/var/log/MySQL目录可以通过该程序来初始化.卸载MySQLrpm -qa|grep -i MySQLrpm -ev MySQL-server-4.0.14-0 MySQL-client-4.0.14-0卸载后/var/lib/MySQL中的数据及/etc/f不会删除,如果确定没用后就手工删除rm -f /etc/frm -rf /var/lib/MySQLMySQL 1130错误解决方法:通过MySQL-Front或MySQL administrator连接MySQL的时候发生的这个错误ERROR 1130: Host ***.***.***.*** is not allowed to connect to this MySQL server说明所连接的用户帐号没有远程连接的权限,只能在本机(localhost)登录。

相关主题