首页
登录 | 注册

Mysql二进制包安装

MYSQL版本:5.1.47 MySQL Community Server (GPL)
 
1.wget http://mysql.ntu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.47-linux-i686-icc-glibc23.tar.gz
 
将下载好的二进制安装包解压
tar zxvf msyql5.1.47
mv mysql5.1.47 /usr/local/
cd /usr/local
mv mysql5.1.47 mysql
添加mysql组,并且将mysql用户加入mysql组。
2.安装
如果用/usr/local/mysql/scripts/mysql_install_db --user=mysql
有可能会报如下错误:
FATAL ERROR: Could not find ./bin/my_print_defaults
If you are using a binary release, you must run this script from
within the directory the archive extracted into. If you compiled
MySQL yourself you must run 'make install' first.
解决办法:应指定安装路径,数据存放路径
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
3.设置目录访问权限
chown -R mysql /usr/local/mysql(所属mysql用户) 
chown -R mysql /usr/local/mysql/data(数据目录所属mysql用户)
4.启动测试
 /usr/local/mysql/bin/mysqld_safe --user=mysql &
 如果有类似提示
100610 02:42:28 mysqld_safe Logging to '/var/log/mysqld.log'.
100610 02:42:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100610 02:42:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
因为mysql找不到可以读的文件/var/run/mysqld/mysqld.pid,查看之下,发现没有该目录
解决办法:
 mkdir /var/run/mysqld
 chown -R mysql /var/run/mysqld
 chgrp -R mysql /var/run/mysqld   
再次启动  /usr/local/mysql/bin/mysqld_safe --user=mysql &
提示成功
访问 /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.47 MySQL Community Server (GPL)
 
 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
说明已经安装成功
改个mysql的root用户密码吧
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> UPDATE user SET password=PASSWORD("xxx.com") WHERE user='root';
Query OK, 1 row affected (0.02 sec)
Rows matched: 2  Changed: 1  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 
5.停止测试
 /usr/local/mysql/bin/mysqladmin shutdown
提示:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' !!!!!
竟然有这样的事情,原来pid文件是放在pid-file=/var/run/mysqld/mysqld.pid
不如做个软件链接吧:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
再次运行
/usr/local/mysql/bin/mysqladmin shutdown
提示
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
是没有指定用户
 
/usr/local/mysql/bin/mysqladmin shutdown -u root -p
输入密码后
100610 04:16:19 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[1]+  Done                    /usr/local/mysql/bin/mysqld_safe
mysql程序结束。
 

相关文章

  • MySQL默认的超级管理员是root 连接方法:mysql -u root 默认密码为空 修改密码的方法:mysqladmin -u root password 'new password' PostgreSQL默认的超级管理员密码是pos ...
  • CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)方法步骤
    CentOS 6.6系统安装配置图解教程 //www.iis7.com/os/239738.html vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp ...
  • 这次主要说一下MAC下安装Mysql 目前是MACOS 10.10.2 使用brew来安装mysql brew --version 0.9.5 直接使用brew install mysql即可安装,安装过程也是十分的顺利,只是编译的时候需要 ...
  •     普华桌面3安装完毕后,为了满足操作喜欢,需要进行一些设置工作,同时安装需要的软件工具.         1.设置主机名         2.终端字体大小调节         3.文本编辑器kwrite字体大小调节.换行        ...
  • *查看linux的版本 [root@mysql etc]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) *前置条件,安装gcc和gcc-c++ yum -y in ...
  • 我想很多程序员应该记得 GitHub 上有一个 Awesome - XXX 系列的资源整理.awesome-python 是 vinta 发起维护的 Python 资源列表,内容包括:Web 框架.网络爬虫.网络内容提取.模板引擎.数据库. ...

2020 unjeep.com webmaster#unjeep.com
12 q. 0.012 s.
京ICP备10005923号