`
lixusign
  • 浏览: 15318 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

MySQL安装

阅读更多
1.下载MySQL组件
   MySQL-client-5.5.8-1.linux2.6.i386.rpm (客户端)
   MySQL-server-5.5.8-1.linux2.6.i386.rpm (服务端)
————————————————————————————————————
2.开始安装
  命令行: rpm -ivh MySQL-server-5.5.8-1.linux2.6.i386.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 localhost.localdomain 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!
————————————————————————————————————
出现以上内容,表示安装成功!
————————————————————————————————————
注:RPM安装的程序都会被安装到预设目录中:
      /etc 一些设定文件放置的目录,例如/etc/crontab
      /usr/bin一些可执行档案
      /usr/lib一些程序使用的动态函式库
      /usr/share/doc一些基本的软件使用手册与说明文件
      /usr/share/man一些man page档案
————————————————————————————————————
3.根据提示:/usr/bin/mysqladmin -u root password 'new-password'
  要求到这个目录的mysqladmin中 设置账号密码
  当我们进入到这个目录时发现出现错误(如下):
  bash: /usr/bin/mysqladmin: No such file or directory(表示没有这个目录)
  以上说明我们需要安装客户端也就是:MySQL-client-5.5.8-1.linux2.6.i386.rpm
————————————————————————————————————
4.命令行:rpm -ivh MySQL-client-5.5.8-1.linux2.6.i386.rpm
Preparing...   ########################################### [100%]
1:MySQL-client ########################################### [100%]
安装完成后查看(ll /usr/bin/mysql*),/usr/bin/目录下多了很多文件,
由安装完server后的14个,变成了26个,并且有了mysqladmin文件。
————————————————————————————————————
5.好了,开始设置mysql的root管理员账号密码吧
  命令行:mysqladmin -u root password manager
  出现:mysqladmin: connect to server at 'localhost' failed
        error: 'Can't connect to local MySQL server through socket '/var/lib   
        /mysql/mysql.sock' (2)'
        Check that mysqld is running and that the socket: '/var/lib/mysql       
        /mysql.sock' exists!
  晕! 竟然出现了一堆错误!
  我们来排查一下吧:
  1. 查看mysql默认端口号3306是否被占用
     netstat -an命令查看mysql默认端口3306的情况,没有查找到
  2. (什么?太多了 用这个命令吧)
     用netstat -pan|grep 3306查看短款的情况也可以
     命令行: netstat -pan|grep 3306 #查询结果为空
     [root@localhost bin]#
     出现以上结果表示什么都没有。
  3. 紧接着进入/var/lib/mysql下面查看”mysql.sock”文件是否存在,显示不存在!
  4. [root@localhost /]# /etc/rc.d/init.d/mysql status
      MySQL is not running                                [失败]
  通过以上检查得知:原来是MySQL没被启动,那我们就启动他吧。
————————————————————————————————————
6.启动MySQL:[root@localhost]# /etc/init.d/mysql start
  停止MySQL:[root@localhost]# /usr/bin/mysqladmin -u root -p shutdown
————————————————————————————————————
7.好了启动成功了!然后继续设置登录(root)密码吧!如下:
  [root@localhost bin]# mysqladmin -u root password "manager"
  看看mysql.sock文件是否存在了:重新进入/var/lib/mysql/查看mysql.sock文件
  发现已经存在了!
————————————————————————————————————
8.太好了! 下面我们从客户端登录一下吧
  [root@localhost bin]# mysql -u root -p (注意一定是/usr/bin 目录下)
  在根目录可以: [root@localhost /]# /usr/bin/mysql -u root -p  这样
  提示请输入密码:********
————————————————————————————————————
9.OK 进入了
  create database XXX
  use XXX
  然后就开始操作吧!
————————————————————————————————————
总结:好了!以上就是MySQL的安装过程,我是参考以下的连接完成的
      http://www.51testing.com/?uid-113838-action-viewspace-itemid-226098
      这篇博客中还提到了 以后的MySQL的优化,有时间再总结吧!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics