installation is divided into Yum installation and source package installation
Yum Installation:
1. Use Yum info MySQL to view the source belt MySQL version 5.1 on the CentOS system
2, so directly yum-y install MySQL Mysql-server can complete the installation
3,/etc/init.d/mysql Start | Stop | Restart # Start | Stop | Restart | Mysql
4, mysql-uroot-p #首次进入mysql无密码; but you need to initialize MySQL, that is, start MySQL.
5. Configure the initial root password; format: mysqladmin-u User password Password
Mysqladmin-u Root Passwordredhat
6, modify the user password; format: mysqladmin-u user-p password password
Mysqladmin-u root-p Passwordadmin
SOURCE Package Installation:
1. mysql Source bundle: wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73.tar.gz
2. Create user, Basedir DataDir
useradd -s /sbin/nologin mysql mkdir -p /opt/mysql mkdir -p /opt/data/mysql chown mysql /opt/data/mysql
3, pre-compilation parameter configuration
./configure --prefix=/usr/local/mysql 其中有报错信息,需要安装相对应的库文件> yum install -y gcc yum install -y gcc-c++ yum -y install ncurses* yum install -y libtermcap* 编译过程中出现“/bin/rm: cannot remove `libtoolT‘: No such file or directory” 报错!;注释掉 configure 文件中的
4. Make && make install
5. Copy MySQL configuration file cp support-files/my-medium.cnf/etc/my.cnf
初始化数据库 ./scripts/mysql_install_db --user=mysql --datadir=/opt/data/mysql/ 拷贝启动脚本 cp support-files/mysql.server /etc/init.d/mysqld
6, modify the permissions, and set the boot start.
chmod 755/etc/init.d/mysqld
Chkconfig--add mysqld
Chkconfig mysqld on
7. Start MySQL service/etc/init.d/mysqld start
启动报错:检查: 7.1 可以先使用此命令验证m‘y.cnf有没有错; /opt/mysql/bin/mysqld_safe 若可以正常启动,则证明my.cnf没有问题。 7.2 关闭selinux 7.3 查看data/mysql权限
8. Set MySQL password mysqladmin-uroot password ' redhat '
9. Setting Environment variables
vim /etc/profile/ PATH=$PATH:/opt/mysql/bin/ source /etc/profile/
At this point, the MySQL source package installation is complete.
Install MySQL 5.1 under Centos 6.*