MySQL基础知识
1MySQL简介
1.1产品百科
MySQL基本概念
|
"LAMP"组合一个稳定、免费的网站系统
|
系统特性
|
存储引擎
|
总结: 瑞典MySQL AB公司开发,目前属于Oracle公司。 MySQL是一种关联数据库管理系统 由于其体积小、速度快、总体拥有成本低 MySQL软件采用了双授权政策(本词条"授权政策"),它分为社区版和商业版 http://www.mysql.com/ |
1.2产品版本
MySQL产品版本
MySQL标准版 MySQL企业版 MySQL集群版 |
结论: 下载Community版本, 免费..... OK Enterprise版本 30天试用期 http://www.mysql.com/ |
2MySQL下载和安装
2.1MySQL产品下载
产品下载
|
下载注意细节
|
2.2MySQL产品下载
MySQL Linux上安装 0 oracle官网上下载的mysql有以下几个rpm包
1 查询服务器上已经安装的mysql rpm -aq | grep mysql
mysql-5.0.77-3.el5 mysql-server-5.0.77-3.el5 libdbi-dbd-mysql-0.8.1a-1.2.2 mysql-connector-odbc-3.51.26r1127-1.el5 mysql-5.0.77-3.el5
--- qt-mysql-4.6.2-25.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 mysql-bench-5.1.66-2.el6_3.x86_64 mysql-devel-5.1.66-2.el6_3.x86_64 libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64 mysql-test-5.1.66-2.el6_3.x86_64 mysql-libs-5.1.66-2.el6_3.x86_64 mysql-5.1.66-2.el6_3.x86_64 mysql-connector-java-5.1.17-6.el6.noarch mysql-server-5.1.66-2.el6_3.x86_64
2 卸载旧的版本 rpm -e mysql --nodeps --allmatches (不理会依赖关系,删除所有上一步查出来的相同的mysql)
[root@localhost home]# rpm -e mysql-connector-odbc-3.51.26r1127-1.el5 --nodeps --allmatches [root@localhost home]# rpm -e libdbi-dbd-mysql-0.8.1a-1.2.2 --nodeps --allmatches [root@localhost home]# rpm -e mysql-server-5.0.77-3.el5 --nodeps --allmatches
[root@localhost home]# rpm -aq | grep mysql [root@localhost home]#
3 将老版本的几个文件手工删除 #rm -f /etc/my.cnf #rm -rf /var/lib/mysql #rm -rf/var/share/mysql # rm -rf/usr/bin/mysql*
4 上传mysql的安装包 MySQL-client-advanced-5.6.20-1.el6.x86_64.rpm MySQL-devel-advanced-5.6.20-1.el6.x86_64.rpm MySQL-server-advanced-5.6.20-1.el6.x86_64.rpm
5 安装服务器和客户端 #rpm -ivh MySQL-server-advanced-5.6.****-1.el6.x86_64.rpm
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect, no other statement but 'SET PASSWORD' will be accepted. See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database. This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings
#rpm -ivh MySQL-client-advanced-5.6.****-1.el6.x86_64.rpm 说明:不安装mysql-client是不能使用mysql工具登陆到mysql数据库
6 oracle收购Mysql后,新版的mysql刚安装完mysql后不能直接输入mysql登录数据库, 而是设置了默认free password密码,默认密码放在了/root/.mysql_secret文件中,登陆后需要修改密码
7 修改密码 (1)查看文件寻找密码 vi /root/.mysql_secret (2)登陆Mysql linux mysql 服务启动和关闭 service mysql start service mysql stop
登陆服务器 mysql -u root -p (3)修改密码 mysql> set password=password('123456') ;
也可以使用脚本 /usr/bin/mysql_secure_installation进行交互式的修改mysql的root密码 |