1.linux 休修改密码:passwd
2.linux 添加用户 useradd
3:mysql 的安装目录在/usr/local/mysql下
4.修改mysql用户的root权限:/usr/bin/mysqladmin -u root password 'new-password'
5.启动MySQL,注意使用用户为mysql:
/usr/local/mysql/bin/mysqld_safe --user=mysql
6.关闭数据库:
mysqladmin -uroot -pxxxx -hxxxxxxxxx shutdown
7.创建数据库
crate database sms
8.创建用户并且付所有权限
GRANT ALL PRIVILEGES ON *.* TO root@% IDENTIFIED BY 'jiangjianqiang' WITH GRANT OPTION;
9.创建用户,后付所有权限
insert into user(host,user,password) values('localhost','test',PASSWORD('t'));
grant all privileges on usertest.* to test;
flush privileges
如同楼上朋友说的确定是否设了权限,如果设了还不行的话,最好先彻底卸载mysql
1.rpm -qa|grep mysql
mysql......
2.rpm -e mysql....
3.重装,参见:sd44兄的:
http://www.linuxsir.com/bbs/showthre...&threadid=2085
4. 初始化
安装结束后,初始化数据库
scripts/mysql_install_db
然后是设置权限
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql
(假定mysql装在/usr/local/mysql目录下,运行完scripts/mysql_install_db ,会产生/usr/local/mysql/var 目录,看有没有/usr/local/mysql/var 目录,这步很重要,我前两次装因没彻底卸载mysql
结果就运行完scripts/mysql_install_db 也找不到/usr/local/mysql/var 目录,
所以chown -R mysql /usr/local/mysql/var 就没能运行,结果就出现楼主的问题,不知你是不是这种情况,参考一下)
5. 为 root 设置密码
/usr/local/mysql/bin/mysqladmin -u root -p password 123456
回车后系统会提示你输入当前密码,应该是像下面这样:
Enter password:
因为此时还没有密码,所以直接回车即可,这时没有任何提示返回提示符状态,而密码已经设置完成。
6) 调试 自启动
系统启动时加载mysql
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysql
cd /etc/rc.d/rc3.d
ln -s ../init.d/mysql S70mysql