mysql数据库基础命令结尾

27 使用mysqladmin 关闭数据库

mysqladmin -uroot -poldboy123 shutdown
ps -ef |grep mysql

28 mysql忘记密码重新修改密码过程:

mysql> mysqld_safe --skip-grant-tables --user=mysql --defaults-file=/data/3306/my.cnf >/dev/null &

-> mysqld_safe --skip-grant-tables --user=mysql  >/dev/null &

-> update mysql.user set  password=password("oldboy111") where user=‘root‘ and host=‘localhost‘;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘mysqld_safe --skip-grant-tables --user=mysql --defaults-file=/data/3306/my.cnf >‘ at line 1

mysql> update mysql.user set  password=password("oldboy111") where user=‘root‘ and host=‘localhost‘;

Query OK, 1 row affected (0.35 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> Terminated

在此 ,重新开启一个窗口杀掉mysql 注意!千万不要用kill-9 粗暴的杀死mysql,这样会导致数据库丢数据后果将非常严重

ill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# pkill mysql

[[email protected] ~]# /etc/init.d/mysqld start

Starting MySQL.... SUCCESS!

[[email protected] ~]# ps -ef | grep mysql

root      10974      1  0 18:39 pts/2    00:00:00 /bin/sh /application/mysql/bin/mysqld_safe --datadir=/application/mysql/data --pid-file=/application/mysql/data/root.pid

mysql     11148  10974  3 18:39 pts/2    00:00:00 /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --log-error=/application/mysql/data/root.err --pid-file=/application/mysql/data/root.pid

root      11181  10136  0 18:39 pts/2    00:00:00 grep mysql

[[email protected] ~]# mysql -uroot -poldboy111

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.6.34-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> \q

Bye

[[email protected] ~]# mysql -uroot -poldboy111

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 6

Server version: 5.6.34-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>

时间: 2024-08-02 07:03:29

mysql数据库基础命令结尾的相关文章

mysql数据库基础命令汇总2

14 在test表中字段name前插入age字段 类型tinyint(2) mysql> create table test (id int(4) not null, name varchar(16) not null); Query OK, 0 rows affected (0.36 sec) mysql> desc test; +-------+-------------+------+-----+---------+-------+ | Field | Type        | Nul

MySQL数据库基础知识

day02 MySQL数据库基础知识 一.基础知识概述: 基础决定你这门课程的学习成败!只有学习好这些基础知识以后,你才能真正的运用自如.才能够对数据库有更深入的了解,道路才会越走越远. 二.基础知识: 1.数据库(database):数据库就好比是一个物理的文档柜,一个容器,把我们整理好的数据表等等归纳起来. 创建数据库命令:        create database 数据库名; 2.查看数据库         show databases; 3.打开指定的数据库         use 

MYSQL数据库基础

MySQL数据库基础 本文的所有操作是基于CMD命令行操作方式,且可适当参考<打通MySQL的操作权限>中的内容,该文算是针对前期的环境配置问题提供了一个较为全面的解决方案,与本文是一个相(yao)辅(xiang)相(hu)成(ying)的关系. 一.连接相关 1. 启动MySQL服务器:net start mysql 2. 连接MySQL数据库:mysql -uroot -h127.0.0.1 -ppassword 3. 断开MySQL数据库:连接到MySQL服务器后,可通过在MySQL提示

边记边学PHP-(十四)MySql数据库基础操作1

提到数据库,相信都不陌生.比较常见的是SQL Server . Oracle.Access.SQLite等等.当然还有PHP的黄金搭档,MySql数据库.当然我所写的都是MySql的一些基础,我还没有深入的学习这个数据库.深入学习还需要一段时间.但是现在学的基础基本满足我现在的学习需要. 一.MySQL简介 1.MySQL是什么 MySQL是一款安全.跨平台.高效的,并与PHP.Java等主流编程语言紧密结合的数据库系统.该数据库系统是由瑞典的MySQL AB公司开发.发布并支持,由MySQL初

MYSQL数据库基础学习笔记

一.mysql的安装与初始化: 安装mysql命令: yum install -y mysql-server mysql mysql-devel 初始化: service mysqld start   //第一次启动mysqld服务会自动初始化: 创建用户并初始化密码: mysqladmin -u root passwd '密码' 登陆mysql: mysql -u root -p 退出mysql: quit.exit 设置mysqld服务自启动: chkconfig mysqld on mys

MySQL数据库基础(转载)

MySQL数据库基础 安装mysql [[email protected] ~]# yum install mysql mysql-server mysql-devel 2.启动mysql,并设置开机自启动 [[email protected] ~]# service mysqld start/stop/restart/status        #启动/关闭/重启/状态 chkconfig mysqld on/off [[email protected] ~]# chkconfig --lis

MySQL数据库基础(一)——MySQL数据库简介

MySQL数据库基础(一)--MySQL数据库简介 一.MySQL简介 1.MySQL简介 MySQL是一个轻量级关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司.目前MySQL被广泛地应用在Internet上的中小型网站中,由于体积小.速度快.总体拥有成本低,开放源码.免费,一般中小型网站的开发都选择Linux + MySQL作为网站数据库.MySQL是一个关系型数据库管理系统,MySQL是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,而不是将所有数据

MySQL数据库基础(三)——SQL语言

MySQL数据库基础(三)--SQL语言 一.SQL语言简介 1.SQL语言简介 SQL是结构化查询语言(Structured Query Language),是用于访问和处理数据库的标准的计算机语言.SQL语言的功能如下:A.SQL面向数据库执行查询B.SQL可从数据库取回数据C.SQL可在数据库中插入新的记录D.SQL可更新数据库中的数据E.SQL可从数据库删除记录F.SQL可创建新数据库G.SQL可在数据库中创建新表H.SQL可在数据库中创建存储过程I.SQL可在数据库中创建视图J.SQL

备份MySQL数据库的命令

这篇文章主要介绍了mysql数据库备份常用语句,包括数据库压缩备份.备份多个MySQL数据库.备份多个MySQL数据库.将数据库转移到新服务器等语句 代码如下: mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql 备份MySQL数据库为带删除表的格式 备份MySQL数据库为带删除表的格式,能够让该备份覆盖已有数据库而不需要手动删除原有数据库. 代码如下: mysqldump -–add-drop-tab