1、建立操作系统用户和组
[[email protected] ~]# groupadd mysql
[[email protected] ~]# useradd -g mysql mysql
2、解压安装文件
[[email protected] ~]# cd /usr/local/
[[email protected] local]# mkdir mysql
[[email protected] mysql]# tar -zxvf /mnt/mysql-5.5.53-linux2.6-x86_64.tar.gz
[[email protected] mysql]# ln -s mysql-5.5.53-linux2.6-x86_64/ mysql
3、初始化mysql数据库(在数据目录下创建系统数据库和系统表,--user表示这些数据库和表的owner是此用户):
[[email protected] data]# cd /usr/local/mysql/mysql/
[[email protected] mysql]# scripts/mysql_install_db --user=mysql
4、修改mysql安装目录权限:
[[email protected] mysql]# pwd
/usr/local/mysql
[[email protected] mysql]# chown -R mysql:mysql mysql
5、启动mysql数据库:
[[email protected] mysql]# bin/mysqld_safe --user=mysql &
[[email protected] ~]# ps -ef|grep mysql
root 26716 26537 0 11:45 pts/2 00:00:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 26797 26716 0 11:45 pts/2 00:00:00 /usr/local/mysql/mysql/bin/mysqld --basedir=/usr/local/mysql/mysql --datadir=/usr/local/mysql/mysql/data --plugin-dir=/usr/local/mysql/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/mysql/data/faspdev.err --pid-file=/usr/local/mysql/mysql/data/faspdev.pid
6、访问mysql数据库: