搜档网
当前位置:搜档网 › linux下mysql的安装与卸载

linux下mysql的安装与卸载

linux下mysql的卸载、安装全过程
本文由ruilinxiang贡献
https://www.sodocs.net/doc/6011903959.html,/s/blog_48d5933f0100ts7t.html
linux下mysql的卸载、安装全过程
卸载mysql
1、查找以前是否装有mysql
命令:rpm -qa|grep -i mysql
可以看到mysql的两个包:
mysql-4.1.12-3.RHEL4.1
mysqlclient10-3.23.58-4.RHEL4.1
2、删除mysql
删除命令:rpm -e --nodeps 包名
( rpm -ev mysql-4.1.12-3.RHEL4.1 )
3、删除老版本mysql的开发头文件和库
命令:rm -fr /usr/lib/mysql
rm -fr /usr/include/mysql
注意:卸载后/var/lib/mysql中的数据及/etc/https://www.sodocs.net/doc/6011903959.html,f不会删除,如果确定没用后就手工删除
rm -f /etc/https://www.sodocs.net/doc/6011903959.html,f
rm -fr /var/lib/mysql
安装mysql
安装前准备:两个rpm包
MySQL-client-5.1.20-0.glibc23.i386.rpm
MySQL-server-5.1.20-0.glibc23.i386.rpm
1、安装服务端:
命令:rpm -ivh MySQL-server-5.1.20-0.glibc23.i386.rpm
安装成功会出现....
warning: MySQL-server-5.1.20-0.glibc23.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
080220 13:58:27 [Note] Plugin 'InnoDB' disabled by command line option
080220 13:58:28 [Note] Plugin 'InnoDB' disabled by command line option
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'
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
https://www.sodocs.net/doc/6011903959.html,
Support MySQL by buying support/licenses at https://www.sodocs.net/doc/6011903959.html,
Starting MySQL.[ OK ]
2、安装客户端
命令:rpm -ivh MySQL-client-5.1.20-0.glibc23.i386.rpm
成功表现:
[root@localhost ~]# rpm -ivh MySQL-client-5.1.20-0.glibc23.i386.rpm
warning: MySQL-client-5.1.20-0.glibc23.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
3、登陆mysql
登陆MySql的命令是mysql,mysql 的使用语法如下:
mysql [-u username] [-h host] [-p[password]] [dbname]
username 与 password 分别是 MySQL 的用户名与密码,mysql的初始管理帐号是root,没有密码,注意:这个root用户不是Linux的系统用户。MySQL默认用户是root,由于初始没有密码,第一次进时只需键入mysql即可
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.20-beta MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
出现了“mysql>”提示符,恭喜你,安装成功!
增加了密码后的登录








如果

忘记了MySQL的root密码,可以用以下方法重新设置:

1.KILL掉系统里的MySQL进程;

2.用以下命令启动MySQL,以不检查权限的方式启动;

mysqld_safe -skip-grant-tables &

3.然后用空密码方式使用root用户登录MySQL;

mysql -u root

4.修改root用户的密码;

mysql> update https://www.sodocs.net/doc/6011903959.html,er set password=passworduecom where User='root';mysql> flush privileges;
mysql> quit

5.重新启动MySQL,就可以使用新密码登录了。






相关主题