- 浏览: 792377 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
xueweiabcok:
PowerDesigner15官方正式版+注册补丁 -
春天好:
博主写的很好,赞一个,多谢分享 *(^-^*)分享一个免费好用 ...
爬虫技术 -
零度弥合:
每天进步1%,那你一百天就成神啦。
Linux下Grails开发环境变量配置 -
dajian0822:
问下,那你显示存储CKEditor文本存储后,在用CKEdit ...
CKEditor学习笔记 -
mengfei86:
...
爬虫技术
近期由于工作需要,加上偶上辈子修来的福分,让偶一个坐coder的,去linux下配置运行环境。故,经历了些事,且总结了点东东,今晚有机会写下点东东,与各位分享一下...
在linux环境下,在进行mysql数据库的安装前,请确认当前linux下,没有mysql的安装版本,或之前旧版本的mysql已经卸载完全。
有关如何在linux下卸载mysql,可以参考我的另一篇博文 http://syc001.iteye.com/admin/blogs/1149267
ok,进入正题:
/*****---------------- mysql setup begin -------------------*****/
1:需要先查看LINUX的版本, 使用如下命令
[ysong@sva_rec mysql]# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 5.2 (Tikanga) Release: 5.2 Codename: Tikanga
然后,去mysql官网http://dev.mysql.com/downloads/mysql/下载MySQL的相应版本的安装文件.
一般情况下,下载两个和linux系统相对应的mysql安装文件即可。分别是server和client版本。
http://downloads.mysql.com/archives.php?p=mysql-5.1&v=5.1.58
RedHat Enterprise Linux 5 RPM (AMD64, Client programs) (4 Jul 2011, 7.2M)
RedHat Enterprise Linux 5 RPM (AMD64, Server) (4 Jul 2011, 20.3M)
具体文件见2.
2:这里,我将下载后的对应的安装文件放到linux下自定义的一个新建的文件夹mysql下。
使用命令安装相应的rpm文件。在mysql文件路径下,输入如下命令,即可
首先,安装服务器端 :
[ysong@sva_rec mysql]#rpm -ivh MySQL-server-community-5.1.58-1.rhel5.x86_64.rpm
其次,安装客户端 :
[ysong@sva_rec mysql]#rpm -ivh MySQL-client-community-5.1.58-1.rhel5.x86_64.rpm
eg:
[root@uhzg006191 software]# rpm -ivh MySQL-server-community-5.1.58-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 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
[root@uhzg006191 software]# rpm -ivh MySQL-client-community-5.1.58-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
[root@uhzg006191 software]#
3:安装完成后,
mysql安装目录可能在:/usr/bin/mysql
mysql启动文件可能在: /etc/rc.d/init.d/mysqld
可以使用whereis mysql命令来查找它安装的路径
可以使用命令 rpm -qal | grep mysql 确定linux下已安装MYSQL的安装路径,Eg:
[ysong@sva_rec mysql]# rpm -qal | grep mysql
//使用如下命令查看系统是否已经安装mysql
[ysong@sva_rec mysql]# rpm –qa | grep mysql
或键入命令:
[ysong@sva_rec mysql]$ netstat -nat
tcp 0 0 127.0.0.1:3306 127.0.0.1:33648 ESTABLISHED tcp 0 0 127.0.0.1:3306 127.0.0.1:33649 ESTABLISHED
出现以上内容。
或,直接敲入命令mysql+回车
[ysong@IDC ~]$mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5136 Server version: 5.1.58-community MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
出现此情此景,即表示linux下mysql安装成功
/*****---------------- mysql setup over -------------------*****/
以下是对已安装完成的mysql,进行相应的配置
/*****---------------- mysql config begin -------------------*****/
/***----- config password -------***/
MySQL默认没有密码,安装完毕增加密码的重要性是不言而喻的。
1、命令
usr/bin/mysqladmin -u root password 'new-password'
格式:mysqladmin -u用户名 -p旧密码 password 新密码
例:给root加个密码ysong。
键入以下命令 :
[ysong@sva_rec ~]$ /usr/bin/mysqladmin -u root password ysong
注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。
此时,在敲入,即可访问mysql
[ysong@sva_rec ~]$ mysql -uroot -pysong
[ysong@IDC ~]$mysql -uroot -pysong Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5159 Server version: 5.1.58-community MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
/***----- config server start and stop -------***/
1、用命令启动mysql
MySQL安装完成后启动文件mysql在/etc/init.d目录下,在需要启动时运行下面命令即可。
[ysong@sva_rec ~]$sudo /etc/init.d/mysql start
注:sudo运行,不然可能会报错,权限原因;
[ysong@sva_rec ~]$ /etc/init.d/mysql start
Starting MySQL.Manager of pid-file quit without updating file.[失败]
2、用命令停止mysql
[ysong@sva_rec ~]$ /usr/bin/mysqladmin -u root -pysong shutdown
/***----- config user -------***/
1:创建用户:
CREATE USER ' pig'@'% ' IDENTIFIED BY 'ysong';
[ysong@sva_rec ~]$ mysql -uysong -psong
[ysong@sva_rec ~]$ mysql -uroot -pysong
grant all privileges on e6mall.* to ysong@'%'
grant select,insert,alter,drop on e6mall.* to ysong@"%" identified by "song";
GRANT ALL PRIVILEGES ON e6mall.* TO ysong@"%" IDENTIFIED BY "song";
use mysql;
select user,password from user;
delete from user where user is NULL
update user set password='ysong' where user is 'ysong';
2:授权:
use mysql
update user set password=password('mysql') where user='root';
update user set password=password('ysong') where user='ysong';
flush privileges;
/*****---------------- mysql config over -------------------*****/
最后,创建数据库,导入数据库sql文件。
mysql -uroot -pysong
create database e6mall;
mysql -uroot -pysong e6mall < /opt/mysql/e6mall.sql;
/********------------------------- Blog over ----------------------------*********/
OVER.....
GO TO BED!....
以上为个人亲手实验而总结出来的,如果各位看客看完后,能有点收获,偶不胜荣幸......
发表评论
-
Linux crontab 命令格式与详细例子
2014-01-08 18:56 764基本格式 :* * * * * command分 ... -
Linux的五个查找命令:find,locate,whereis,which,type
2013-12-27 16:21 14331. find find是最常见和最强大的查找命令,你可 ... -
"tar: z: unknown function modifier"错误
2013-12-26 21:08 1696某些linux版本的机器上使用 tar -zxvf *.ta ... -
Ubuntu 出现apt-get: Package has no installation candidate问题
2013-04-15 09:42 29810Refer to : http://blog.csdn.ne ... -
Linux Mysq表名的大小写问题
2012-12-18 20:53 1141MySQL在Linux下数据库名、表名、列名、别名大小写规则是 ... -
“can’t create transaction lock on /var/lib/rpm/__db.000”错误解决
2011-08-15 10:14 2482“can’t create transaction lock ... -
Linux下删除卸载系统自带的MySQL数据库
2011-08-15 10:05 3745近期由于工作需要,加 ... -
查看linux系统版本命令
2011-08-14 15:18 801查看linux系统版本命令: [ysong@ID ... -
Linux red5下压力测试根据webbench安装与使用
2011-07-25 11:08 2750webbench最多可以模拟3万个并发连接去测试网站的负载能力 ... -
linux开机启动脚本的顺序
2011-07-01 16:38 1469在Redhat Redflag centos fc linux ... -
linux java tomcat grails 全配置
2011-08-16 20:57 1027vi /etc/profile文件 段落最后添加 相应的 ... -
修改linux默认jdk版本
2011-06-30 15:03 2073当你已经成功把jdk1.6.0_24 安装到 /usr/jav ... -
Linux vi command
2011-06-30 13:40 1170Linux Vi编辑器入门: ... -
window xp 使用SecureCRT上传和下载文件 && 中文乱码处理
2011-06-28 09:15 6055SecureCRT是一个非常优秀的终端登录工具,可以以tel ... -
Linux basic command 【常用命令】
2011-06-28 08:57 1308Demo 大都有两种操作, 一种是cd到目标文件所在文件夹 ... -
LInux 下grails 环境配置
2011-06-27 17:03 14331: 到grails的官方网站下载http://grails. ... -
LInux 下tomcat环境配置
2011-06-27 16:42 24771:到tomcat官网,http://tomcat.apach ... -
Linux下 java环境配置
2011-06-27 16:12 1858法一: 1:到java官网http://www.jav ... -
linux eclipse开发环境配置
2011-06-09 15:02 4547前景描述: 我在linux上下载安装了eclipse,运行 ... -
Linux下Grails开发环境变量配置
2011-06-07 17:51 2984如何配置Grails环境变量# 第一步:打开http ...
相关推荐
linux下安装MySQL数据库及相关配置,比较详细。
解说ubuntu下mysql的安装配置等一系列注意事项和方法
实验七-Linux-MySQL数据库服务器配置与管理知识分享.docx实验七-Linux-MySQL数据库服务器配置与管理知识分享.docx实验七-Linux-MySQL数据库服务器配置与管理知识分享.docx实验七-Linux-MySQL数据库服务器配置与管理...
linux-CentOS6.4下Mysql数据库的安装与配置
Linux下MySQL数据库安全配置指南
mysql的详细配置文件,有myisam和innodb的配置参数说明以及性能参考方案
本书全面、深入地讲解Linux下的数据库开发技术,既涵盖理论基础,又囊括案例开发,既包括Linux操作系统和数据库技术的基础知识,又详细介绍MySQL数据库的安装/配置、查询优化、安全管理及MySQL可视化管理工具的使用...
linux安装配置mysql数据库
【怎么在linux下安装mysql数据库并配置的方法】.pdf【怎么在linux下安装mysql数据库并配置的方法】.pdf
【怎么在linux下安装mysql数据库并配置的方法】.docx【怎么在linux下安装mysql数据库并配置的方法】.docx
在linux下,开发一个web应用,期间调用数据库时总是不成功,如果单独写一个类,并编译执行访问数据库,正常,但是用web应用来调这个类连接数据库,就会出现错误:... ** BEGIN NESTED EXCEPTION ** ...
MySQL是一种强大而灵活的关系型数据库,无论您是开发Web应用程序还是进行数据分析,了解如何安装和配置MySQL服务器以及如何管理MySQL数据库都是至关重要的。希望本文能够帮助您在安装和配置MySQL过程中遇到问题时...
Linux全攻略--MySQL数据库配置与管理[汇编].pdf
文档详细描述了linux操作系统中mysql数据库的安装配置、并以三台mysql服务器为例进行了三台mysql数据库之间互为主从的配置讲解
本文档是一篇linux下安装mysql的教程,其内容包括mysql数据库安装,用户配置,主从配置等。
linux下mysql安装、目录结构、配置
教程名称:各大数据库安装与配置大全课程目录:【】-Linux全攻略--MySQL数据库配置与管理【】-mysql-5.5配置安装【】-oracle卸载及其安装文档【】-sql server2005数据库安装手册【】-SQLSERVER2000数据库安装详解...
Mysql数据库的安装对于开发者来说,是我们必然会面对的问题,它的安装过程其实并不复杂,并且网络上的安装教程也非常多,但是对于新手来说,各种不同形式的安装教程,又给新手们带来了要选择哪种方式进行安装的难题...
3、使学生熟悉MySQL数据库在Windows平台和Linux平台下的安装配置以及MySQL的目录结构。 二、进行重点知识的讲解 (1)什么是数据库? 《MySQL数据库入门》教学设计全文共7页,当前为第2页。教师首先向同学讲述...