linux下mysql5.5的安装

#rpm –qa|grep –i mysql查看已安装的mysql版本

如果有已存在的mysql版本�则删除

安装服务端和客户端,去Oracle官网下载:

# rpm -ivh MySQL-server-5.5.28-1.linux2.6.i386.rpm

# rpm -ivh MySQL-client-5.5.28-1.linux2.6.i386.rpm

安装后会出现以下信息,提示不要忘记设计root用户的密码以及其他信息。

之后查看mysql的服务是否启动�#netstat -nat

如看到有3306的端口号,就说明服务启动了,默认的端口是3306 ,如果没有启动的话 ,就打开服务 #service mysql start  启动mysql服务。

然后再输入mysql,若出现以下提示信息,说明成功。

Welcome to the MySQL monitor.  Commands end with ; or g. Your MySQL connection id is 1 Server version: 5.5.16 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

进入mysql数据库后:mysql>use mysql;

然后查看一下root的情况select user,password form user;

修改密码�update user set password=password(‘newpassword’)where user=’root’ and host=’root’ or host=’localhost’;

至此�mysql是安装成功了的。

但是远程访问还是不行的,还有两个地方,第一是数据库设置,第二是防火墙。一般数据库已经是可以直接连接成功的了。只是没有ROOT权限,如果连不上,像我这样的,肯定是被防火墙挡住了。

数据库的MYSQL表中控制的可来访的权限,因此我们要改一下它,这样我们就有ROOT权限了。

 

myql可以远程登录
设置mysql密码
mysql>; USE mysql; 
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root'; 
mysql>; FLUSH PRIVILEGES; 
1.2.3 允许远程登录 
mysql -u root -p 
Enter Password: <your new password> 
mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION; 
完成后就能用mysql-front远程管理mysql了。 
设为开机启动 
chkconfig mysqld on
原文地址:https://www.cnblogs.com/xingmeng/p/3221114.html