欢迎来到天天文库
浏览记录
ID:8807742
大小:77.90 KB
页数:4页
时间:2018-04-08
《centos安装mysql5.5.21》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、#rpm–qa
2、grep–imysql查看已安装的mysql版本如果有已存在的mysql版本,则删除#rpm–e–nodeps查看到的mysql的文件名先将文件拷贝到/usr/local/src下,进入src[root@localhost~]#cd/usr/local/src[root@localhostsrc]#rpm-ivhMySQL-server-5.5.21-1.linux2.6.x86_64.rpm安装后会出现以下信息,提示不要忘记设计root用户的密码以及其他信息之后会出现[root@localhostsrc]#输入
3、[root@localhostsrc]#rpm-ivhMySQL-server-5.5.21-1.linux2.6.x86_64.rpm查看是否存在安装的mysql文件之后查看mysql的服务是否启动,#netstat-nat默认的端口是3306,如果没有启动的话,就打开服务#servicemysqlstart启动mysql服务启动服务后,进入mysql进入mysql数据库后,usemysql然后查看一下root的情况:selectuser,passwordformuser;修改密码:updateusersetpassword=
4、password(‘newpassword’)whereuser=’root’andhost=’root’orhost=’localhost’;最好是提交commint一下。然后再查看一下用户至此,mysql是安装成功了的。参考资料:7:ip访问then:selecthost,userfromuser; mysql>selecthost,userfromuser;+-----------------------+------+
5、host
6、user
7、+-----------------------
8、+------+
9、%
10、test
11、
12、127.0.0.1
13、root
14、
15、localhost
16、
17、
18、localhost
19、root
20、
21、localhost
22、test
23、
24、localhost.localdomain
25、
26、
27、localhost.localdomain
28、root
29、+-----------------------+------+7rowsinset(0.00sec)然后修改一个root
30、用户的host为你的ip地址 updateuserusetu.host='your_ipaddress'whereu.user=rootandu.host='localhost'; updateuserusetu.host='192.168.1.42'whereu.user=rootandu.host='localhost'; mysql>selecthost,userfromuser;+-----------------------+------+
31、host
32、user
33、+-----------
34、------------+------+
35、%
36、test
37、
38、127.0.0.1
39、root
40、
41、192.168.1.42
42、root
43、
44、localhost
45、test
46、
47、localhost.localdomain
48、root
49、+-----------------------+------+5rowsinset(0.00sec) 8:重启:servicemysqldrestart 重启服务要在[root@localhost~]#重启。需
50、要先退出mysql 9:退出mysql:exit;
此文档下载收益归作者所有