One: Lamp architecture
II: MYSQL/MARIADB Introduction
Three: MySQL Installation
Several popular versions of MySQL download
5.1_64 bits binary Package: http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz
5.1_32 bits binary Package: http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-i686-glibc23.tar.gz
5.5_64 bits binary Package: http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.47-linux2.6-x86_64.tar.gz
5.5_32 bits binary Package: http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.47-linux2.6-i686.tar.gz
5.6_32 bits binary Package: http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.27-linux-glibc2.5-i686.tar.gz
5.6_64 bits binary Package: http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz
5.5 Source Bundle: http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.47.tar.gz
5.6 Source Bundle: http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.27.tar.gz
Go to/usr/local/src download
Initialize MySQL
tar zxvf /usr/local/src/mysql-5.1.73-linux-i686-icc-glibc23.tar.gz //解压mv mysql-5.1.73-linux-i686-icc-glibc23 /usr/local/mysql //挪动位置useradd -s /sbin/nologin mysql //建立 mysql 用户cd /usr/local/mysql mkdir -p /data/mysql // 创建 datadir,数据库文件会放到这里面,5.7.16版本需要建立在mysql主目录下 chown -R mysql:mysql /data/mysql //更改权限 ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 5.7改为./bin/mysqld --initialize-insecure --user=mysql --datadir=/u01/mysql/data/mysql/ --basedir=/u01/mysql/
--user defines the owner of the database,--datadir defines where the database is installed, and it is recommended to place the partition-insecure in a large space to indicate that the initial password is not set when MySQL is installed. This step is critical if you see two "OK" instructions to execute correctly.
(1) Error encountered:./bin/mysqld:error while loading shared libraries:libstdc++.so.5:cannot
Open Shared Object file:
Workaround:
yum install -y compat-libstdc++-33
(2) Error encountered:./scripts/mysql_install_db:./bin/my_print_defaults:/lib/ld-linux.so.2:bad
ELF interpreter:no such file or directory
This is because your system version is inconsistent with the MySQL version. For example, your system is 32-bit, the result you download
A 64-bit package. So, the solution is to download the appropriate package.
Configure MySQL
Copy the configuration file (version 5.7 needs to modify the My.cnf file yourself)
cp support-files/my-large.cnf /etc/my.cnf 拷贝启动脚本文件并修改其属性 cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld 修改启动脚本 vim /etc/init.d/mysqld 需要修改的地方有 “basedir=/usr/local/mysql;datadir=/data/mysql” (前面初始化数据库时定义的目录)。把启动 脚本加入系统服务项,设定开机启动并启动 mysql chkconfig --add mysqld chkconfig mysqld on service mysqld start 如果启动不了,请到 /data/mysql/ 下查看错误日志,这个日志通常是主机名.err。检查 mysql 是否启动的命令为: ps aux |grep mysqld
installation of MySQL