MySQL Basic operation

Source: Internet
Author: User

Start off

/etc/init.d/mysqld start

Netstat-lntup | grep 3306

Ps-ef | grep MySQL | Grep-v grep

Root 1946 1 0 01:51 PTS/1 00:00:00/bin/sh/application/mysql/bin/mysqld_safe--datadir=/application/mysql/ Data--pid-file=/application/mysql/data/lnmp.com.pid

MySQL 2187 1946 0 01:51 pts/1 00:00:00/application/mysql/bin/mysqld --basedir=/application/mysql--da Tadir=/application/mysql/data--plugin-dir=/application/mysql/lib/plugin--user=mysql--log-error=/application/ Mysql/data/lnmp.com.err--pid-file=/application/mysql/data/lnmp.com.pid--socket=/tmp/mysql.sock--port=3306

VIM/ETC/INIT.D/MYSQLD//Startup process

$bindir/mysqld_safe--datadir= "$datadir"--pid-file= "$mysqld _pid_file_path" $other _args >/d ev/null 2>&1 &

mysqld_safe--user=mysql & //Startup method given at initialization

/etc/init.d/mysqld stop

ss-lnt | grep 3306

LISTEN 0 50 *:3306

Killall mysqld Pkill mysqld killall-9 mysqld//Try not to rudely close the database


mysqladmin-uroot-p123456 shutdown

Landing

Ifconfig//See if it's a test or a formal environment, back up the database

Mysql

Mysql-uroot - P


mysql> prompt \[email protected] \r:\m:\s->//Modify Prompt

[Email protected] 02:13:09->


[MySQL]

Prompt \[email protected] \r:\m:\s->///ETC/MY.CNF

Help

Mysql> Help

Exit

Password


mysqladmin -u root password ' 123456 '//most commonly used simple and practical

Mysqladmin-u root-p ' 123456 ' password ' 123123 '


Select User,host,password from Mysql.user;

mysql> Update Mysql.user set Password=password (456) where user= ' root ' and host= ' localhost '; To specify a condition

Mysql> Set Password=password (' 123123 ');

Mysql> flush Privileges;

Retrieve MySQL root user password


/etc/init.d/mysqld stop

Mysqld_safe--skip-grant-tables--user=mysql &//Ignore authorization form if it is compiled, the default is/usr/local/mysql will have an error.

Sed-i ' S#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe


Update user set Password=password (new password) where user= ' root ' and host= ' localhost ';==> set a new password

Flush Privileges;==> Refresh

New open Window mysqladmin-uroot-p shutdown ==> new password test shut down the database, successfully closed to prove the success of the modification


Multiple instances to specify mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-tables


Mysqld_safe--skip-grant-tables --skip-networking &

// skip-networking

You cannot access MySQL remotely after you turn on this option

For security reasons, you can add Bind-address=ip to the configuration file if you want to specify IP access to MySQL, as long as you turn off skip-networking


This article is from the "what-all" blog, please be sure to keep this source http://hequan.blog.51cto.com/5701886/1771935

MySQL Basic operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.