




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一、从官网下载MySQL Community Server/downloads/选择相应的系统,通常linux选择Linux-Generic下载即可二、创建用户首先创建mysql用户,组mysql,根目录/home/mysql或者命令 groupadd mysqluseradd -g mysql -d /home/mysql mysql三、将安装包ftp传至/home/mysql/install下解压(最好建一个install目录,因为会解压出来很多包)MySQL-5.5.20-1.linux2.6.x86_64.tar传至/home/mysql/install mysqlhadoop2 $pwd/home/mysql/installmysqlhadoop2 $ ls -ltotal 183164-rw-r-r- 1 mysql mysql 187371520 Feb 10 10:32 MySQL-5.5.20-1.linux2.6.x86_64.tarmysqlhadoop2 $ tar xvf MySQL-5.5.20-1.linux2.6.x86_64.tar MySQL-client-5.5.20-1.linux2.6.x86_64.rpmMySQL-devel-5.5.20-1.linux2.6.x86_64.rpmMySQL-embedded-5.5.20-1.linux2.6.x86_64.rpmMySQL-server-5.5.20-1.linux2.6.x86_64.rpmMySQL-shared-5.5.20-1.linux2.6.x86_64.rpmMySQL-test-5.5.20-1.linux2.6.x86_64.rpm四、安装1、先查看原主机上又没有mysql(root用户操作)roothadoop2 install$ rpm -qa|grep mysqlmysql-5.0.77-4.el5_5.4如果有继续安装,会如下安装失败:roothadoop2 install$ rpm -ivh MySQL-server-5.5.20-1.linux2.6.x86_64.rpm error: Failed dependencies: MySQL conflicts with mysql-5.0.77-4.el5_5.4.x86_64所以要先卸载或升级,但是我升级和卸载都报了一个依赖的错,因为有个dovecot依赖如下,最后加了个-nodeps参数解决,roothadoop2 install$ rpm -Uvh MySQL-server-5.5.20-1.linux2.6.x86_64.rpm error: Failed dependencies: libmysqlclient.so.15()(64bit) is needed by (installed) dovecot-1.0.7-7.el5.x86_64 libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) dovecot-1.0.7-7.el5.x86_64roothadoop2 install$ rpm -e mysql-5.0.77-4.el5_5.4error: Failed dependencies: libmysqlclient.so.15()(64bit) is needed by (installed) dovecot-1.0.7-7.el5.x86_64 libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) dovecot-1.0.7-7.el5.x86_64roothadoop2 installrpm -e mysql-5.0.77-4.el5_5.4 -nodepsroothadoop2 home# rpm -qa|grep mysqlroothadoop2 home#2、安装server和clientroothadoop2 install# rpm -ivh MySQL-server-5.5.20-1.linux2.6.x86_64.rpm Preparing. # 100% 1:MySQL-server # 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 hadoop2 password new-passwordAlternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.Please report any problems with the /usr/bin/mysqlbug script!Notes regarding SELinux on this platform:=The default policy might cause server startup to fail because it isnot allowed to access critical files. In this case, please updateyour installation.The default policy might also cause inavailability of SSL relatedfeatures because the server is not allowed to access /dev/randomand /dev/urandom. If this is a problem, please do the following: 1) install selinux-policy-targeted-sources from your OS vendor 2) add the following two lines to /etc/selinux/targeted/src/policy/domains/program/mysqld.te: allow mysqld_t random_device_t:chr_file read; allow mysqld_t urandom_device_t:chr_file read; 3) cd to /etc/selinux/targeted/src/policy and issue the following command: make load roothadoop2 installrpm -ivh MySQL-client-5.5.20-1.linux2.6.x86_64.rpmPreparing. # 100% 1:MySQL-client # 100%roothadoop2 install#chown -R mysql:mysql /usr/share/mysql3、安装完启动mysqlhadoop2 mysql$pwd/usr/share/mysqlmysqlhadoop2 mysql$ /usr/share/mysql/mysql.server startStarting MySQL. OK ./mysql.server脚本是调用/usr/bin/mysqld_safe来启动mysql的4、查看mysql是否启动,看进程+3306端口mysqlhadoop2 mysql$ netstat -an|grep 3306tcp 0 0 :3306 :* LISTEN mysqlhadoop2 mysql$ ps -ef|grep mysqld_safemysql 4637 1 0 11:54 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe -datadir=/var/lib/mysql -pid-file=/var/lib/mysql/hadoop2.pidmysql 5001 4606 0 13:50 pts/0 00:00:00 grep mysqld_safe5、设定root用户密码roothadoop2 mysql# mysqladmin -u root password 6543210这是第一次设定,如果修改就是mysqladmin -u root -p 旧密码password 新密码6、尝试连接mysqlhadoop2 $ mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 5Server version: 5.5.20 MySQL Community Server (GPL)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type help; or h for help. Type c to clear the current input statement.mysql7、修改可以远程登录mysqluse mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql select host,user, Password ,Select_priv from user;mysql grant all on *.* to root% identified by 6543210;Query OK, 0 rows affected (0.00 sec)mysql GRANT USAGE ON *.* TO root% WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)mysql select host,user from user where user=root;mysql flush privileges;Query OK, 0 rows affected (0.00 sec)修改用户密码mysqluse mysql;mysqlupdate user set password=password(新密码) WHERE User=root and host=%; mysqlflush privileges;这样远程登录就可以成功了。8、修改字符集查看原字符集:mysqluse mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql show variables like character_set% ;mysql show variables like collation_%;需要将/usr/share/mysql/f my-innodb-heavy-4G.cnf f f f任意一个(根据数据库的需求,本例用large)copy至/etc下,修改为froothadoop2 cp /usr/share/mysql/f /etc/froothadoop2 vi /etc/f在client下添加default-character-set=utf8 在mysqld下添加character_set_server=utf8 在mysql 下添加default-character-set=utf8 mysql hadoop2 /usr/share/mysql/mysql.server restart进行查看9、修改SQL不区分大小写在/etc/f 中的mysqld后添加lower_case_table_names=1,重启MYSQL服务10、支持procedure或者function编译及执行在mysql中编译或者执行procedure或者function时,可能会报如下错误This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)两种方法(1) 在/etc/f 中的mysqld后添加添加log_bin_trust_function_creators = 1,重启MYSQL服务(2) 在控制台执行SQL set global log_bin_trust_function_creators = 1;不过重启后会失效五、启动停止1、启动mysqlhadoop2 mysql$pwd/usr/share/mysqlmysqlhadoop2 $ /usr/share/mysql/mysql.server startStarting MySQL. OK 2、停止mysqlhadoop2 $ /usr/bin/mysqladmin u root p shutdownEnter password:或者mysqlhadoop2 $ /usr/share/mysql/mysql.server stop3、重启mysqlhadoop2 $ /usr/share/mysql/mysql.server restart4、通过chkconfig设置开机自动启动roothadoop2 mysql# chkconfig mysql onroothadoop2 mysql# chkconfig -list mysqlmysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off六、基本使用mysql show databases; /查看数据库mysql use test /选择数据库Database changedmysql show tables; /查看表 Empty set (0.00 sec)mysql create table gl(id int(3) auto_increment not null primary key, name char(10) not null); /创建表Query OK, 0 rows affe
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年地籍测量员技能鉴定高级面试重点题
- 2025年环保安全生态保护题集答案
- 2025年企业人力资源管理师三级考试预测题
- 2025年美容美发技能大师挑战赛试题及答案解析
- 2025年教育心理学家专业能力评估试题及答案解析
- 课件中文字的处理
- 2025年建筑师注册考试试题及答案解析
- 2025年建筑钢结构工程安全监理员职业资格考试试题及答案解析
- 2025年环境治理工程师职业技能考试试题及答案解析
- 2025年国际财务分析师资格考试试题及答案解析
- 宁德新能源verify测试题库
- GB/T 30790.8-2014色漆和清漆防护涂料体系对钢结构的防腐蚀保护第8部分:新建和维护技术规格书的制定
- 幼儿急症救助
- 期末复习放射物理与防护大专习题集
- 主通风机司机培训教材课件
- 酒店运营管理课件
- 2022年红河产业投资集团有限公司招聘笔试题库及答案解析
- 肺心病(课)课件
- 中国烟草PPT模板
- 急性淋巴管炎的护理查房
- 江苏省综合评标专家库题库
评论
0/150
提交评论