Installation Steps:
sudo apt-get update
sudo apt-install mysql-server
-
sudo apt-get install libmysqlclient-dev
If you want to install the specified version you can refer to this /weixin_45562068/article/details/131805863
Check if the service is running
systemctl status mysql
Change user name and password
sudo vim /etc/mysql/
Connecting to the database
utilizationmysql -u [user] -p[password]
Next change the username and password:
Changing a username directly is not a recommended operation in MySQL because it can lead to permissions and ownership issues. Instead, it is common practice to create a new user, grant it the necessary permissions, and then delete the old user.
Create a new user:
Use the CREATE USER statement to create a new user.
CREATE USER 'new_username'@'localhost' IDENTIFIED BY 'new_password';
Replace new_username with your new username, localhost with the hostname, and new_password with your new password.
Granting Permissions:
Use the GRANT statement to grant the old user's privileges to the new user.
GRANT ALL PRIVILEGES ON *.* TO 'new_username'@'localhost';
Adjust permissions and database objects as needed.
Update permissions:
If there are any stored programs or views that use the old username, you will need to update them to use the new username.
Delete the old user:
Use the DROP USER statement to delete the old user.
DROP USER 'old_username'@'localhost';
Replace old_username with the old username.
Refresh permissions:
Execute the following command to make the permission changes take effect.
FLUSH PRIVILEGES;
Test Login
Connect using the username and password you just set up. After successful configuration as shown below.
At this point the use of Ubuntu configuration mysql has all finished, you can happily use the database ah.