linux安装mysql5.1.73,linux下安装mysql5.1.73 rpm

安装包下载 MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar

需要安装

MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm

MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

安装了client,在服务器上才能用mysql命令连接到mysql服务器

本人采用mysql用户安装的,用sudo rpm

linux下mysql5.1卸载 rpm

添加mysql组

[root@dev soft]# groupadd mysql

添加mysql用户

[root@dev soft]# useradd -g mysql mysql

[root@dev /]# cd /soft

[root@dev soft]# mkdir mysql-5.1.73

把MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar上传至此目录

改变目录及以下文件的所有者

[root@dev soft]# chown -R mysql ./mysql-5.1.73/

切换用户

[root@dev soft]# su - mysql

[mysql@dev ~]$# cd /soft/mysql-5.1.73

对用户加执行权限

[mysql@dev mysql-5.1.73]$ chmod u+x MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar

解压文件

[mysql@dev mysql-5.1.73]$ tar -xvf MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar

MySQL-community-debuginfo-5.1.73-1.rhel5.x86_64.rpm

MySQL-embedded-community-5.1.73-1.rhel5.x86_64.rpm

MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

MySQL-shared-compat-5.1.73-1.rhel5.x86_64.rpm

MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm

MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm

MySQL-shared-community-5.1.73-1.rhel5.x86_64.rpm

MySQL-test-community-5.1.73-1.rhel5.x86_64.rpm

对用户加执行权限

[mysql@dev mysql-5.1.73]$ chmod u+x ./*

安装mysql服务器

非root用户用rpm命令安装会报如下错误[mysql@dev soft]$ rpm - ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm

error: can't create transaction lock on /var/lib/rpm/__db.000

非root用户使用rpm可以采用 sudo 命令 的方式,sudo 需要配置

[mysql@dev mysql-5.1.73]$ sudo rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-server-community ########################################### [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 dev 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!

Starting MySQL..[确定]

Giving mysqld 2 seconds to start

查看服务是否启动

[mysql@dev mysql-5.1.73]$ netstat -nat

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address               Foreign Address             State

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN

安装客户端

[mysql@dev mysql-5.1.73]$ sudo rpm -ivh MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-client-community ########################################### [100%]

连接服务器端,此时root的密码是空,所以只用写mysql就可以

[mysql@dev mysql-5.1.73]$ mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.73-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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用户的密码

[mysql@dev mysql-5.1.73]$ mysqladmin -u root password "password"

修改密码后客户端登录

[mysql@dev mysql-5.1.73]$ mysql -u root -p

Enter password:

mysql修改root 可以远程访问,两种方式

1.通过授权命令

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

此操作会在user表插入一条新的记录。

2.直接改表

mysql> UPDATE user SET Host='%' WHERE User='root' AND Host='localhost' LIMIT 1;

刷新权限

mysql> flush privileges;

安装好后还要做一些配置,如设置编码

linux下mysql5.1的配置 rpm

其他操作

创建数据库

mysql> create database ucms;

创建用户,%表示可以从任何服务器连接

mysql> CREATE USER 'ucms'@'%' IDENTIFIED BY 'ucms';

授权,把ucms数据库是所以权限授权给ucms用户

mysql> GRANT ALL PRIVILEGES ON ucms.* TO 'ucms'@'%' IDENTIFIED BY 'ucms' WITH GRANT OPTION;

刷新权限,使之生效

mysql> FLUSH PRIVILEGES ;

linux安装mysql-5.1.60 tar.gz

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值