快捷搜索:

Centos6.5 mysql折腾记,centos6.5mysql折腾

Centos6.5 盛世创富mysql折腾记,centos6.5mysql折腾
1、yum安装mysql

[[email protected] ~]# yum -y install mysql-server
安装结果
Installed:
  mysql-server.x86_64 0:5.1.73-7.el6                                                            

Dependency Installed:
  mysql.x86_64 0:5.1.73-7.el6                perl-DBD-MySQL.x86_64 0:4.013-3.el6               

Complete!
2、设置开机启动
[[email protected] ~]# chkconfig mysqld on
3、MySQL服务 3.1、MySQL服务开启
[[email protected] ~]# service mysqld start
3.2、MySQL服务关闭
[[email protected] ~]# service mysqld stop
3.1、MySQL服务重启
[[email protected] ~]# service mysqld restart
4、MySQL密码 4.1、设置密码
[[email protected] ~]#  mysql -u root
mysql> set password for [email protected]=password('root');
mysql> exit
4.2、密码忘记 4.2.1、修改/etc/my.cnf
 1 [mysqld]
 2 datadir=/var/lib/mysql
 3 socket=/var/lib/mysql/mysql.sock
 4 user=mysql
 5 #最重要的下面这一行代码
 6 skip-grant-tables
 7 # Disabling symbolic-links is recommended to prevent assorted security risks
 8 symbolic-links=0
 9 
10 [mysqld_safe]
11 log-error=/var/log/mysqld.log
12 pid-file=/var/run/mysqld/mysqld.pid
4.2.2、重启MySql
[[email protected] ~]# service mysqld restart
4.2.3、修改密码
1 [[email protected] ~]# mysql -u root
2 mysql> use mysql;
3 mysql> set password for [email protected]=password('root');
4 mysql> flush privileges;
5 mysql> exit;
6 [[email protected] ~]# service mysqld restart
4.2.4、修改/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
4.3、MySQL登陆
[[email protected] ~]# mysql -u root -p
4.4、MySQL常用命令
1 show databases; //查看系统已存在的数据库
2 use databasesname;   //选择需要使用的数据库
3 drop database databasename; //删除选定的数据库
4 exit    //退出数据库的连接
5 create database test01;    //建立名为test的数据库
6 show tables;        // 列出当前数据库下的表
7 其他基本的增删改查使用标准SQL即可
4.5、MySQL开放远程登陆权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES;

http://www.bkjia.com/Mysql/1189425.htmlwww.bkjia.comtruehttp://www.bkjia.com/Mysql/1189425.htmlTechArticleCentos6.5 mysql折腾记,centos6.5mysql折腾 1、yum安装mysql [[email protected] ~]# yum -y install mysql-server 安装结果 Installed: mysql-server.x86_64 0:5.1.73-7.el6 Depend...

本文源自: AG88环亚

您可能还会对下面的文章感兴趣: