MySQL: Difference between revisions

From Embedded Workshop
Jump to navigation Jump to search
(Created page with "As part of a MediaWiki Overhaul, I had the opportunity to learn a bit more about MySQL administration. When a database is created, a directory to manage the database is created in /var/lib/mysql. The /var/lib/mysql directory is owned by mysql, with NO access allowed for others. This is OK though, in that administrative tools are provided to backup and restore a database. For a system user to access a mysql database, he needs a mysql database name and password. From...")
 
No edit summary
Line 7: Line 7:
  From there, he can use user (non-root) commands to create, backup, restore, and delete a database.
  From there, he can use user (non-root) commands to create, backup, restore, and delete a database.


[[File:CPanel Databases.jpg|right|thumb]]
  '''Note:'''
  '''Note:'''
  Many shared hosting sites use a "CPanel" webpage interface, allowing their users to create and
  Many shared hosting sites use a "CPanel" webpage interface, allowing their users to create and
  interact with their databases.
  interact with their databases.
==Create Database User==
Without a "CPanel" interface, we need root access to create an initial database user.
The username:
  Must be unique for the database
  Doesn't necessarily require Linux username as part of the name
For this exercise, we will use:
Database user name: "fred123"
Database user password: "fred123password"
Database name: "fredsthings"

Revision as of 09:42, 12 June 2024

As part of a MediaWiki Overhaul, I had the opportunity to learn a bit more about MySQL administration.

When a database is created, a directory to manage the database is created in /var/lib/mysql.
The /var/lib/mysql directory is owned by mysql, with NO access allowed for others.
This is OK though, in that administrative tools are provided to backup and restore a database.
For a system user to access a mysql database, he needs a mysql database name and password.
From there, he can use user (non-root) commands to create, backup, restore, and delete a database.
Note:
Many shared hosting sites use a "CPanel" webpage interface, allowing their users to create and
interact with their databases.

Create Database User

Without a "CPanel" interface, we need root access to create an initial database user.
The username:
  Must be unique for the database
  Doesn't necessarily require Linux username as part of the name
For this exercise, we will use:
Database user name: "fred123"
Database user password: "fred123password"
Database name: "fredsthings"