Install and configure MySQL and tools in Ubuntu, using tumysql
This article shares with you
Installation command:
Copy codeThe Code is as follows: sudo apt-get install mysql-server mysql-client mysql-query-browser mysql-admin
Modify the root password:
Copy codeThe Code is as follows: mysqladmin-u root password "yourpassword"
Configuration:
Note:In Ubuntu, MySQL only allows local access by default. If you want access from other machines, you need to change the/etc/mysql/my. cnf configuration file! Next we will step by step:
After the default MySQL installation, the root user does not have a password. Therefore, use the root user to enter:
$ Mysql-u root-p
-U root is used here because I am a general user (firehare). If-u root is not added, mysql will assume that it is a firehare logon. Note: I have not entered the root user mode here because it is unnecessary. In general, it is not necessary to enter the root user mode to operate the database in mysql. This is only possible when the database is set.
After entering mysql, the most important thing is to set the root user password in Mysql. Otherwise, the Mysql service is no longer secure.
Mysql> grant all privileges on *. * TO root @ localhost identified by "123456 ";
Note: I use 123456 as the root user password, but this password is not safe. Please use a password with a mix of uppercase and lowercase letters and numbers, and at least 8 characters.
In this case, the root user password in MySQL is set up, and then the database you need is created with the root user. Here we take xoops as an example:
Mysql> create database xoops;
Mysql> grant all privileges on xoops. * TO xoops_root @ localhost identified by "654321 ";
In this way, a xoops_roots user is created, which has all permissions on the database xoops. In the future, we will use xoops_root to manage the xoops database, instead of using the root user. This user's permissions will only be limited to the xoops database.
If you want to implement remote access or control, you have to do two things:
1:
Mysql> grant all privileges on xoops. * TO xoops_root @ "%" identified by "654321 ";
Allows the xoops_root user to log on to MySQL from any machine.
Second:
$ Sudo gedit/etc/mysql/my. cnf
> Skip-networking => # skip-networking
This allows other machines to access MySQL.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.