redhat下rpm安装mysql5.1

1、官网下载mysql5.1的rpm包

服务端:MySQL-server-community-5.1.44-1.rhel4.i386.rpm

客户端:MySQL-client-community-5.1.44-1.rhel4.i386.rpm

2、执行rpm命令安装
rpm -ivh
MySQL-server-community-5.1.44-1.rhel4.i386.rpm;

rpm -ivh
MySQL-client-community-5.1.44-1.rhel4.i386.rpm;

3、查看安装是否成功
netstat -ntpl;
 (显示3306端口正在监听表示服务安装成功)

4、修改root密码并测试登录
/usr/bin/mysqladmin -u root
password ‘xxxxxx‘;

mysql -u root -p

5、设置远程访问权限

[改表法]:登陆mysql后,更改“mysql”数据库里的“user”表里的“host”项,将“localhost”改“%”

mysql>use mysql;
mysql>update user set host =‘%‘ where user
=‘root‘;
mysql>select host,user from user;
mysql>FLUSH
PRIVILEGES

[授权法]:假设允许用户username通过密码password从远程连接到mysql服务器
mysql>GRANT ALL
RRIVILEGES ON *.* TO [email protected]‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT
OPTION;
mysql>FLUSH PRIVILEGES;

6、默认安装目录结构
数据目录:/var/lib/mysql/ (安装完后启动失败,可以尝试
shell>chown -R mysql.mysql /var/lib/mysql)

配置文件:/usr/share/mysql(mysql.server命令及配置文件)

相关命令:/usr/bin(mysqladmin、mysqldump等命令)
启动脚本:/etc/rc.d/init.d/

7、停止/启动/重启/mysql服务
service mysql
stop/start/restart;
*mysql的一种安全启动方式:/usr/bin/mysqld_safe –user=root
&

8、修改字符编码
查看当前字符编码
mysql>show variables like
‘character\_set\_%‘;
mysql>show variables like ‘collation_%‘;


停止mysql服务,将目录/usr/share/mysql下的文件my-medium.cnf拷贝到/etc/下并改名为my.cnf

打开my.cnf在[client]和[mysqld]下面均加上default-character-set=utf8,并保存
*mysql5.5
在[mysqld]下面添加参数 character-set-server=utf8
重启mysql服务

9、卸载mysql
rpm -qa|grep -i mysql

MySQL-server-community-5.1.44-1.rhel4.i386.rpm

MySQL-client-community-5.1.44-1.rhel4.i386.rpm
rpm -e
MySQL-server-community-5.1.44-1.rhel4.i386.rpm
rpm -e
MySQL-client-community-5.1.44-1.rhel4.i386.rpm
删除残余文件
rm -f
/etc/my.cnf

rm -f /var/lib/mysql

10、复制mysql数据库
源数据库名:source_db 用户名:root 密码:xxxxxx

目标数据库名:target_db 用户名:root 密码:yyyyyy 所在主机:221.218.9.41
mysqldump
source_db -uroot -pxxxxxx --opt | mysql target_db -uroot -pyyyyyy -h
221.218.9.41

*复制数据表 (源数据库数据表名:source_db_table)
mysqldump source_db
source_db_table -uroot -pxxxxxx --opt | mysql target_db -uroot -pyyyyyy -h
221.218.9.41

时间: 2024-08-26 05:38:32

redhat下rpm安装mysql5.1的相关文章

Centos6下rpm安装MySQL5.6

Centos6在rpm安装 rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm yum install mysql-server –y 启动 service mysqld start 初始化 mysql_secure_installation Enter current password for root (enter for none): Set root password? [Y/n] Remo

CentOS6.5下RPM安装Mysql5.6

一.升级操作 1.卸载旧版本 查看MySQL旧版本 rpm -qa|grep mysql rpm -qa|grep mariadb 卸载MySQL rpm -e --nodeps mysql-5.1.73-7.el6.x86_64 rpm -e --nodeps mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64 rpm -qa|grep mysql 删除数据目录

centos下RPM安装mysql5.7.13

1.查看已有mysql rpm -qa | grep mysql 2.卸载 #yum -y remove mysql-libs-5.1.66-2.el6_3.x86_64 检查并删除老版本mysql的开发头文件和库 命令:#rm -fr /usr/lib/mysql #rm -fr /usr/include/mysql 注意:卸载后/var/lib/mysql中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除 #rm -f /etc/my.cnf #rm -fr /var/lib

centos 下编译安装mysql5.1与mysql5.5

mysql5.1.60编译安装 1.tar -zxvf mysql* 2../configure 之前要make clean ./configure --prefix=/home/shk/mysql-5.1.60 \ --enable-local-infile \ --with-unix-socket-path=/home/shk/mysql-5.1.60/var/mysql.sock \ --with-tcp-port=5506 \ --enable-thread-safe-client \

centos6.5 rpm安装mysql5.6.19操作及步骤

系统:centos 6.5  64位 数据库:mysql5.6.19 64位 采用RPM安装包安装,之后修改mysql默认路径. 首先要卸载系统自带mysql包,命令如下 yum remove mysql mysql-server mysql-libs 检查是否有残留 rpm -qa | grep mysql 若发现有则使用rpm -e 安装包名称 安装步骤: 1.官网下载tar压缩包,下载地址为http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-5.6

mongoDB在redhat下的安装

mongoDB在redhat下的安装 mongoDB下载安装 下载地址:http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.10.tgz root用户依次执行以下操作 tar -zxvf mongodb-linux-x86_64-2.6.10.tgz mv mongodb-linux-x86_64-2.6.10 /usr/local/mongodb cd /usr/local/mongodb mkdir db mkdir logs c

CentOS6.5_64bit下编译安装MySQL-5.6.23

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/44785511 ************************************************************         CentOS6.5_64bit下编译安装MySQL-5.6.23 **************************************************************一.关闭防火墙chkconfig iptable

Redhat下Mysql安装配置

环境信息 ------------------------------------------------------------ RHEL 6 -x86_64 yum(如未安装yum,请先安装yum,参考:安装及源配置) ------------------------------------------------------------ 安装mysql yum搜索mysql yum search mysql 搜索结果如下 MySQL-python.x86_64 : An interface

Redhat下Nginx安装配置

1.下载Nginx curl -O http://nginx.org/download/nginx-1.7.3.tar.gz -o /home/tango 2.安装Nginx 解压 tar -zxvf /home/tango/nginx-1.7.3.tar.gz /home/tango/nginx-1.7.3-setup 准备依赖 yum install pcre-devel yum install openssl-devel 编译,进入/home/tango/nginx-1.7.3-setup