标签:安装mysql
在官网下载安装包。修改mysql目录中data目录权限
chown -R mysql:mysql /home/mysql/data
chmod -R 755 /home/mysql/data
cd support-files/
ls
vim mysql.server
basedir=/home/mysql
datadir=/home/mysql/data
:wq
./support-files/mysql.server start
如果/etc/下没有my.cnf徐璈自己创建一个
touch /etc/my.cnf
vim /etc/my.cnf
*** [client]
port = 3306
#socket = /usr/local/mysql/data/mysql.sock
default-character-set=utf8
cd ..
[mysqld]
**#sqlmode=NOENGINESUBSTITUTION,STRICTTRANSTABLES
**basedir = /home/mysql
datadir = /home/mysql/data
port = 3306
#socket = /usr/local/mysql/data/mysql.sock
charactersetserver=utf8
initconnect=‘SET NAMES utf8‘**
:wq
(配置文件不全可在其他地方拷贝)*
把启动脚本放到开机初始化目录中
cp /home/mysql/support-files/mysql.server /etc/init.d/mysqld
创建软连接
ln -s /home/mysql/bin/mysql /usr/bin/mysql
chmod 755 /etc/init.d/mysql
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld 把mysql注册为开启启动项
chkconfig --list mysqld 查看是否添加成功
chkconfig mysqld on
cd bin
./mysql -u root -p
系统生成的初始密码
set password=password(‘新密码‘);
use mysql;
update user set host=‘%‘ where user=‘root‘;
GRANT ALL PRIVILEGES ON . TO root@‘%‘ IDENTIFIED BY ‘设置的密码‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
service mysqld restart
标签:安装mysql
原文地址:http://blog.51cto.com/12760193/2094593