标签:support evel use 直接 server usr 拷贝 mic 创建
下载链接:http://ftp.ntu.edu.tw/MySQL/Downloads/
1:拷贝数据库到 /application/mysql 改名为mysql文件名
2:数据库初始化
1)useradd mysql -s /sbin/nologin -M 创建用户
2)chown -R mysql.mysql /application/mysql/data 用户授权
3)./scripts/mysql_install_db --user=mysql --basedir=/application/mysql/ --datadir=/application/mysql/data/ 指定初始化用户 指定安装目录 指定数据文件库表等
2个ok才算成功
/application/mysql//bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
yum install -y libaio
rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
3:添加启动服务 \cp support-files/mysql.server /etc/init.d/mysqld
在cp指令前面加反斜杠可以不弹出是否覆盖的询问而直接覆盖!
4:修改启动脚本文件路径,否则启动失败
/etc/init.d/mysqld start
Starting MySQLCouldn‘t find MySQL server (/usr/local/mysql/[失败]sqld_safe)
vi /etc/init.d/mysqld,添加路径
5:杀掉进程,启动mysqld
[root@centos 6 mysql]# killall mysqld
[root@centos 6 mysql]# /etc/init.d/mysqld start
Starting MySQL.. [确定]
注意:登录不上,可能没有配置文件需要
cp support-files/my-small.cnf /etc/my.cnf
killall mysqld
/etc/init.d/mysqld start
6:设置密码 [root@centos 6 mysql]# /application/mysql/bin/mysqladmin -u root password ‘111111‘
7:登录mysql mysql -uroot -p111111
8:mysqld 提示
①vi /etc/profile
PATH=/application/mysql/bin:$PATH
退出vi 执行. /etc/profile即可
②也可以 cp /application/mysql/bin/* /usr/local/sbin/
9:
data目录下查看错误
10:优化数据库
mysql> drop database test;
mysql> select user,host from mysql.user;
mysql> drop user ‘root‘@‘::1‘;
mysql> drop user ‘‘@‘centos \6‘;
mysql> drop user ‘root‘@‘centos \6‘;
mysql> drop user ‘‘@‘localhost‘;
mysql> select user,host from mysql.user;
11:
创建用户
mysql> grant all on *.* to daixubinbin@‘A‘ identified by ‘123‘;
删除用户
mysql> drop user ‘daixubinbin‘@‘a‘;删除如果报错,使用sql语句
mysql> delect from mysql.user where user=‘daixubinbin‘ and host=‘a‘;
常见问题
yum -devel
chmod -R 4777 /tmp
登不上:
初始化DB不正常 rm -rf /application/mysql/data/ mysql_install_db......
看data/..err日志
标签:support evel use 直接 server usr 拷贝 mic 创建
原文地址:https://www.cnblogs.com/daixubinbin/p/11366931.html