2.系统中可能存在自带的MySQL,采用命令进行强制删除
rpm –qa|grep mysql
rpm -e mysql-5.1.61 --nodeps强制删除mysql 不考虑依赖关系 (此处根据上一步查询到的结果)
3.安装mysql
rpm -ivh MySQL-server-community-5.1.61-0.rhel5.x86_64.rpm (包名根据实际情况)
4.在MySQL配置文件/etc/my.cnf中根据实际需要添加
lower_case_table_names=1
skip-name-resolve
event_scheduler=1
default-character-set=utf8
wait_timeout=31536000
interactive_timeout=31536000
5.启动服务
cd /etc/init.d
./mysql restart
或者service mysqld restart
6.登陆MySQL
/usr/local/mysql/bin/mysql -u root –p
7.新增用户,根据允许访问的地址和用户,可能需要多次执行。
GRANT ALL PRIVILEGES ON *.* TO 'user'@'192.168.1.1(你的ip)' IDENTIFIED BY 'password' WITH GRANT OPTION
flush privileges
8.
用SQLyog之类的图形化数据库管理工具把数据库备份出来的sql语句执行一遍
9.完成
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
tcp0 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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)