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

How to change the system environment variable PATH

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. How to change the system environment variable PATH?

A: if you change the system environment variables permanently, there are two ways to take effect for all users: the third is recommended.

(1) vim / etc/profile join PATH=$PATH:/usr/local/mysql/bin/

(2) vim / etc/bashrc join PATH=$PATH:/usr/local/mysql/bin/

(3) vim / etc/profile.d/path.sh

#! / bin/bash

Export PATH=$PATH:/ usr/local/mysql/bin/

Source / etc/profile.d/path.sh

If you permanently change the system environment variable, which is effective for the current user, there are two ways:

(1) vim ~ / .bash_profile join PATH=$PATH:/usr/local/mysql/bin/

(2) vim ~ / .bahsrc join PATH=$PATH:/usr/local/mysql/bin/

If you are only temporarily changing the environment variables of the current Shell, you can use the command directly:

Export PATH=$PATH:/ usr/local/mysql/bin/

two。 After the default mysql is installed, there is no root password, how to set a password for root?

Answer: mysqladmin-uroot password '123456'

3. How do I change my root password?

Answer: (1) mysqladmin-uroot-p123456 password '654321'

(2) if you forget your root password, you can refer to question 19 to reset it.

4. How do I connect to a remote mysql server?

Answer: mysql-urachy-p123456-h227.0.0.1-P3306

5. How to check the account currently logged into mysql?

Answer: select user ()

6. How do I switch a library under the mysql command line?

A: use discuz

7. How do I see what fields a table has?

A: desc pre_common_style

8. How do I see which database engine is used for a table?

Answer: show create table pre_ucenter_vars\ G

9. How do I see what queues there are in the current database?

A: show processlist

10. How can I see what slow queries there are when there are many queues?

Answer: set the slow query log as follows:

Vim / etc/my.cnf

……

Log_slow_queries = logname

Long_query_time = 1 / / log will be recorded if the query time exceeds 1s

……

11. How do I view the parameter values of the current mysql?

A: show variables

twelve。 How to change a parameter without restarting the mysql service?

Answer: set global var = value

For example, set global wait_timeout = 10

13. What tool do you use to back up the database? Distinguish between the backup of the myisam engine and the innodb engine.

Answer: data from the myisam engine uses mysqldump to back up the database

Data from the innodb engine uses xtrabackup to back up the database

14. Briefly describe the difference between myisam and innodb engines.

Answer: the myisam engine stores the data directly in the file of the system, locks the entire table and does not support transactions; the database of the innodb engine will create a data tablespace file in advance, and then store data from this tablespace file, row locking, support transactions, external keys, b does not support fulltext indexes, nor save the number of rows of the table.

15. If your mysql service doesn't start and the current terminal doesn't report an error, what do you do?

Answer: check the error log file hostname.err in the datadir directory to find out the cause of the failure and solve it.

16. The character set of the library to be backed up is the character set of gbk. In order to avoid garbled code, how to specify the character set as gbk when backing up and restoring?

Answer: specify gbk backup: mysqldump-- default-character-set=gbk

Specify gbk restore: mysql-- default-character-set=gbk

17. In the error log, if there is a prompt that a table is damaged and needs to be repaired, how do you fix the table?

A: repair table tablename

18. When backing up the database of the myisam engine, in addition to using the mysqldump tool to back up, we can also directly copy the source data of the database (.frm, .MYD, .MYI data). Which file can not be copied? What do I do if I want to recover the file?

Answer: the .MYI file can not be copied, and the table needs to be repaired when restoring, but add use_frm, such as repair table tb1 use_frm.

19. What if I forget my root password for mysql?

Answer: (1) vim / etc/my.cnf, add the parameter skip-grant under the [mysqld] field

(2) service mysqld restart

(3) mysql-uroot

(4) use mysql; # switch database

Update user set password=password ('your password') where user='root'; # reset password

Flush privileges; # effective immediately

(5) vim / etc/my.cnf delete the skip-grant you just added

Service mysqld restart

20. How to change the password of mysql's ordinary account?

Answer: update user set password=password ('123456') where user='rachy'

21. Where is the command history file of mysql? for the sake of security, we can actually do a little processing to keep the command history of mysql from being recorded in the document. Please think about how to use the knowledge we have learned to do it.

A: the command history file of mysql is in the .MySQL _ history file in the current user's home directory.

Cd ~

Rm-f. MySQL _ history; # Delete history files

Ln-s / dev/null. MySQL _ history # soft link the history file to null

twenty-two。 How do I make the listening port of mysql 3307 instead of the default 3306?

A: edit the mysql configuration file: vim / etc/my.cnf, so that the parameter port = 3307

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