Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary introduction of mysql common commands

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Settings Change mysqlroot password

First time entering mysql database,

!

mysql absolute path can be added to environment variables,

You can also set the boot load,

Reload environment variables to make mysql work

Log in to mysql -uroot again

Add password to mysql

in authentication,

change the password

Login again for verification, verification successful

Reset password, modify profile, skip authorization

Restart mysql service, no password required for root authentication

Go in and modify the password file.

update user set password=password('aminglinux') where user='root';

Modify my.conf after exiting

Delete the above skip authorization file

Restart mysqld service

Re-enter mysql validation

connect to MySQL

Method 1: use tcpip protocol ip: port, suitable for remote ip, this example is the local machine to do experiments

Method 2: Use socket(provided that my.conf is configured with sock), which is only suitable for local use.

Method 3: Use the command line, suitable for shell scripts

mysql common command

query library show databases;

switch libraries use mysql;

View the tables in the library show tables;

View the fields desc tb_name in the table;

View the table creation statement show create table tb_name\G;

select user();

select database ();

create database db1;

create table use db1; create table t1(id int(4), name char(40)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

drop table t1;

Select version();

View database status show status;

View parameters show variables; wildcards show variables like 'max_connect %';

Modify the parameter set global max_connect_errors=1000; it can also be modified in/etc/my.conf

view queues show processlist; show full processlist;

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report