标签:efault ibdata1 test 查看 创建用户 usr pad extend roo
1、下载Mysql2、解压
cd /opt
mkdir mysql
cd mysql
tar zxvf /path/mysql-5.6........
ln -s /opt/mysql/mysql-5..... /usr/local/mysql
3、创建用户
groupadd mysql
useradd -g mysql -s /sbin/nologin -d /usr/local/mysql/ -M mysql
4、环境变量
echo $PATH
echo PATH=$PATH:/usr/local/mysql/bin >>/etc/profile
source /etc/profile
==============启动起来==================
5、创建必须的目录
/data/mysql/mysql3306/
data
tmp
logs
mkdir -p /data/mysql/mysql3306/{data,tmp,logs}
6、权限
chown -R mysql:mysql /data/mysql/mysql3306/
chown -R mysql:mysql /opt/mysql
7、创建一个配置文件
socket = /tmp/mysql3306.sock
innodb_data_file_path = ibdata1:100M:autoextend
8、初始化
cd /usr/local/mysql
./scripts/mysql_install_db --defaults-file=/etc/my.cnf
看到两次ok
9、启动
/etc/init.d/mysql start or service mysql start
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
/usr/local/mysql/bi
n/mysqld --defualts-file=/etc/my.cnf &
10、安全加固
delete from mysql.user where user!=‘root‘ or host!=‘localhost‘;
truncate table mysql.db;
drop database test;
A 查看进程是否存在
ps aux | grep mysqld
B 查看端口是不是监听正确
netstat -nalp | grep mysqld
ss -lnpt | grep mysqld
C 看看错误日志有无异常
vim shift+g
tail
标签:efault ibdata1 test 查看 创建用户 usr pad extend roo
原文地址:http://blog.51cto.com/9201316/2136140