MySQL5.1 tar.gz安装步骤

这里只是贴出安装过程中的命令和我实际操作后遇到的错误和解决方案,就不一个命令一个命令的详细解释了,不喜勿喷。看不懂的先去学些Linux基础命令再来。谢谢合作

# cp mysql-5.1.51.tar.gz /usr/local/src/
# cd /usr/local/src/
# groupadd -r mysql

# useradd -g mysql -r mysql

# gunzip < mysql-5.1.51.tar.gz | tar -xvf -

# cd mysql-5.1.30

出错:没有安装GCC

解决方法:yum install gcc 

yum install gcc-c++
出错:no curses/termcap library found
解决方法; yum install ncurses-devel

# ./configure –prefix=/usr/local/mysql/ –with-unix-socket-path=/tmp/mysql.sock 
# make 
# make install
# cd /usr/local/mysql/
# chown -R mysql .
# chgrp -R mysql .
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql /usr/local/mysql/var/

# cp -f /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf
# cp -f /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql.server
# /usr/local/mysql/bin/mysql -V

出错:Starting Mysql.manager of pid-file quit without updating file
解决办法:
把/etc/my.cnf 里的skip-federated注释掉,
再初始化MySQL: #/usr/local/mysql/bin/mysql_install_db --user=mysql
#ln -s /usr/local/mysql/bin/mysql /usr/bin
# /etc/init.d/mysql.server status
# /etc/init.d/mysql.server start
# /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.51-log Source distribution

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> exit

Bye

开放RedHat端口:
#vi /etc/sysconfig/iptables
添加-A INPUT -m state --state NEW -m tvp -p tcp --dport 13306 -j ACCEPT
这句话的位置一定要注意。
重启防火墙:#/etc/init.d/iptables restart
 
修改MySQL端口到13306
编辑/etc/my.cnf
在mysqld 下添加
port=3506
重启服务:
#/etc/init.d/mysqld restart

#/usr/local/mysql/bin/mysqladmin -u root -p 123@welcome
出错:error: Access denied for user 'root'@'localhost' (using password: YES)  
解决方案:mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'% IDENTIFIED BY '123@welcome' WITH GRANT OPTION;

//进入MySQL服务器
d:\mysql\bin\>mysql -h localhost -u root
//赋予任何主机访问数据的权限
mysql> GRANT   ALL   PRIVILEGES   ON   *.*  TO   'root' @ '%'   WITH   GRANT   OPTION
//使修改生效
mysql>FLUSH  PRIVILEGES
//退出MySQL服务器


你可能感兴趣的:(linux,mysql)