1.安装gcc-c++
yum -y install gcc-c++
2.安装上传下载
yum install lrzsz
3.上传cmake和mysql5.5
rz
4.解压cmake,并进入解压后的目录
tar zxvf
cd
5.编译安装
./configure
make && make install
6. 安装依赖包
yum install ncurses-devel -y
7.解压mysql并进入到mysql目录
8.创建用户和组
groupadd mysql
useradd mysql -s /sbin/nologin -M -g mysql
225pxake
cmake .-DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \
-DMYSQL_DATADIR=/application/mysql-5.5.32/data\
-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
10. make && makeinstall
11.移动文件
cp support-files/my-small.cnf /etc/my.cnf
12.配置文件
echo ‘exportPATH=/application/mysql/bin:$PATH‘>>/etc/profile
source /etc/profile
echo $PATH
13.将data文件夹和/tmp授权
chown -R mysql.mysql /application/mysql/data/
chmod -R 1777 /tmp/
14.进入到安装目录下的script 初始化数据库
./mysql_install_db--basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
有两个OK就可以了
15.进入源码的support-files目录,并将mysql.server复制到指定位置/etc/init.d/
cp/application/tools/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld
16.给mysqld授权
chmod +x /etc/init.d/mysqld
17.开启mysql
/etc/init.d/mysqld start
18.删除多余用户
delete from mysql.user wherehost=‘localhost.localdomain‘;
或者
drop user ‘root‘@nfsclient;
19.删除多余的数据库test
drop database test
/////////////////////////////////////////////////////////////////////////////////////////////////////
ERROR1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
要输入密码
ERROR 1045 (28000): Access denied for user‘root‘@‘localhost‘ (using password: YES)
密码错误
修改密码错误如下图,请修改字符集,/etc/sysconfig/i18n 将将LANG的值修改为
LANG="en_US.UTF-8"
原文地址:http://zhaol.blog.51cto.com/4185340/1735587