Linux-安装Mysql

1.检查是否存在Mysql,如存在,可以进行卸载。

查看命令:rpm -qa|grep -i mysql

删除命令:rpm -e --nodeps 包名3、删除老版本mysql的开发头文件和库
命令:

rm -fr /usr/lib/mysql
rm -fr /usr/include/mysql
 注意:卸载后/var/lib/mysql中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除
rm -f /etc/my.cnf
 rm -fr /var/lib/mysql


2.安装服务端

我使用的是CentOS6.4,所以下载Red Hat Enterprise Linux 6 / Oracle Linux 6版本的

http://dev.mysql.com/downloads/mysql-4.0.html#downloads

MySQL-client-5.6.14-1.el6.x86_64.rpm

MySQL-server-5.6.14-1.el6.x86_64.rpm

安装命令:rpm -ivh MySQL-server-5.6.14-1.el6.x86_64.rpm

我在安装时遇到缺少rpm包问题,具体缺少以下这些包

这些rpm需要一起安装,才能成功,命令格式如:rpm -ivh p1.rpm p2.rpm p3.rpm

3.登陆Mysql

命令:mysql -u root -p

解决方法参考:http://huangyifa163.blog.163.com/blog/static/262875752011127102215790/

 遇到问题 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
# /etc/init.d/mysql stop
# mysqld_safe  --user=mysql --skip-grant-tables --skip-networking 
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='root' or host='localhost';//把空的用户密码都修改成非空的密码就行了。
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

 4.创建库

遇到错误:ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
 
#提示必须现更改密码才能执行语句
mysql> set password=password('123456');
mysql> CREATE DATABASE IF NOT EXISTS `test_data`;
mysql> USE `test_data`;

 

转载于:https://my.oschina.net/eastwmt/blog/175703

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值