1、初始化密码
>sudo bin/mysqladmin -u root password ‘pwd string‘
2、ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
1)添加启动参数:>mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
2)登录:>mysql -u root mysql
3)更新密码:>UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
4)立刻生效:>FLUSH PRIVILEGES;
3、添加 mysql.server service
1)复制mysql.server脚本到/etc/init.d (初始化服务,mysql.server 即为 serivce status-all 中的服务名)
>sudo cp support-files/mysql.server /etc/init.d/mysql.server
>sudo service mysql.server status
2) 让mysql开机启动[defaults],取消开机启动[remove]
>sudo update-rc.d -f mysql.server defaults [remove]
4、添加bin到环境变量 >sudo export PATH=$PATH:/usr/local/mysql/bin (以mysql/bin所在目录)
5、mysql 安装完成后需要开启网络登录
使用 mysql -u -p 登录后执行 > grant all privileges on *.* to root@"%" identified by "密码文字" with grant option;
初装 MySQL 需要注意的几个环节,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/loudon/p/3819735.html