@L_301_0@
# 将 MysqL-5.5.32-linux2.6-x86_64.tar.gz 上传到 /tmp/ # 新建MysqL用户组 groupadd MysqL # 新建MysqL用户属于MysqL用户组 useradd -r -g MysqL -s /bin/false MysqL -M
# 解压至/usr/local tar zxvf /tmp/MysqL-5.5.32-linux2.6-x86_64.tar.gz -C /usr/local/ cd /usr/local && ln -s MysqL-5.5.32-linux2.6-x86_64 MysqL
# 进入MysqL目录 cd MysqL # 当前目录所有者为MysqL chown -R MysqL . # 当前目录所属组为MysqL chgrp -R MysqL . # 初始化MysqL 自带数据库 ./scripts/MysqL_install_db --user=MysqL --basedir=/usr/local/MysqL/ --datadir=/usr/local/MysqL/data/ # 其中,basedir 指定MysqL 所在路径,datadir 指定MysqL数据存放路径 # 当前目录所有者为root chown -R root . # data目录所有者为MysqL chown -R MysqL data
# 修改配置 \cp support-files/MysqL.server /etc/init.d/MysqLd vi /etc/init.d/MysqLd # 设置下面两项后保存 basedir=/usr/local/MysqL/ datadir=/usr/local/MysqL/data/ #开机启动 chkconfig --add MysqLd chkconfig MysqLd on cp /usr/local/MysqL/support-files/my-small.cnf /etc/my.cnf # 启动MysqL 服务 service MysqLd start # 停止MysqL 服务 service MysqLd stop
MysqL -u root -p # 然后回车进入控制台 # 在进入的MysqL 控制台中执行如下命令 use MysqL; update user set password=PASSWORD("root")where user="root"; grant all privileges on *.* to 'root'@'%' identified by 'root'; flush privileges; # PASSWORD("root") 表示 root的密码为root,若密码要改为123456,则为PASSWORD("123456") select user,host from MysqL.user; # 删掉无用的用户 drop user ''@'dn2';