原文链接:redhat完美安装mysql成功
linux安装mysql可以说是千篇一律,大致都相同,但量如果真正按照所提供的进行安装的话,也不能100%的安装成功,于是干脆自已手动安装一遍来熟悉这个过程,也记录下来供大家参考。
1、以安装mysql-5.1.54.tar.gz为例,如下步骤:
tar -zxvf mysql-5.1.54.tar.gz
cd mysql-5.1.54/
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
make && make install
cd ../
groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
/usr/local/mysql/lib/mysql
/usr/local/lib
EOF
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
/etc/init.d/mysql start
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
/usr/local/mysql/bin/mysqladmin -u root password $mysqlrootpwd
/etc/init.d/mysql restart
/etc/init.d/mysql stop
2、修改数据库的默认存储引擎,首先修改my.ini,在[mysqld]下加上:
default-storage-engine=INNODB
3、通过http或tcp连接访问,通过mysql的命令grant来给root分配一下权限即可,%代表http/tcp都可以访问:
格式:grant 权限 on 数据库名.表名 to 用户@登录主机 identified by “用户密码”;
grant all on *.* to root@'%' identified by '123456';
over,安装步骤记录,方便以后查询使用。