Webmin update mysql




















The default suggestion should be based on the amount of RAM. I don't think that's the case currently, while adding such a feature would be very useful - it would also mean re-inventing the wheel. But it's worth keeping in mind that these things are going to change over time, i. Also, any webmin instances running inside a VPS i.

The wizard already looks at available memory to select the MySQL size. That's a good idea. Besides, I was looking into wizard-lib. Conceptually, a simple "wizard framework" would just need to encapsulate the concept of having an array with "pages", where each single page may consist of an array of "input fields" with optional validation routines for each field server-side via Perl or client-side via JavaScript. So these would be simple linear wizards where navigation is pre-determined - but this would greatly simplify setting up things, especially if this could be made available to use modules.

I think the main thing here is the current assumption that the wizard will always be run as a CGI, if this could be generalized, wizards could also be run by the virtualmin CLI tool - i.

I really belive that this would be a worthwhile addition, as it would enable you guys to focus on providing lower-level building blocks, while empowering your end-users to easily come up with new wizard-driven modules that are nothing more than wrappers for existing CLI tools.

If done properly, there could be a single framework that works for a main use-cases, i. And these wizards could be easily reused, i. At that point, you could also simply invite your users to contribute "wizards" for tools like apachtuner or mysqltuner, instead of jus filing feature requests here There are quite a few feature requests that could be solved that way, i.

Agreed, a custom wizard framework would be a good idea. Regarding your suggestion about wrapping shell commands, there is a module for this in Webmin already. Even though it is possible to enter the username and password for any MySQL user, non-root users cannot perform tasks such as creating databases and tables - and so neither will the module be able to.

By default, the module is configured to login with the username and password that the MySQL package for your distribution uses by default. Often there are several, named something like mysql, mysql-client, mysql-server and mysql-devel. Each Linux distribution seems to use a different set of packages, so make sure you install them all.

If the module complains that it cannot find the mysql program even though you have it installed, you will need to adjust the paths that it uses. This can happen if you installed it from the source instead of using the package that comes with your Linux distribution.

To execute these commands Webmin must connect to the database server, which can be done in one of two ways. It can either run the mysql command with the correct parameters and parse its output, or use the Perl DBI library to connect directly. The former method is always available, because the mysql command is always installed when the database server is. However, it is not totally reliable as certain kinds of table data produce output that cannot always be parsed.

If either is missing, a message will be displayed at the bottom of the main page prompting you to install one or both by clicking on a link. When MySQL is first installed, a database called mysql is created that contains authentication and access control related tables.

If you want to store your own data, it is best to create your own database to add tables to instead of messing with the mysql database. To do this, the steps to follow are:. Tables can be added to newly created or existing databases at any time. Every table has one or more fields, each of which has a type such as integer, decimal or text and a size.

Fields can also be indexed, to speed up SQL queries that look up records based on the values in that column. To add a new table to a database, the steps to follow are :. New fields can be added to a table and existing ones changed or deleted. Adding a field poses no risk to existing data, but changing the type or size of one may - and deleting a field will cause the data that it contains to be lost. To add a new field, the steps to follow are:.

Newly created or existing fields can be edited as well, by following the steps below. However, making changes to the type of a field or reducing its size may result in data loss if the old values are not compatible with the new type. For example, converting a varchar to an int will cause all non-numeric values to be lost - however, converting an int to a varchar is generally safe as long as the new size is large enough.

An existing field can be removed by clicking the Delete button on the field editing form instead of Save. Any data that it contains will be immediately deleted forever. Naturally, you cannot delete the last field in a table. Newer versions of MySQL may introduce more types, but you should still be able to edit the data in fields of unsupported types though. The MySQL module allows you to view the contents of any table in any database.

Tables that have a primary key can have their records modified or deleted and new ones added as well. Unfortunately, there is no way to edit the contents of a table without a key, as the module needs some way of identifying specific records. All tables in a database should have one though. If the table has a primary key, this same page can also be used to edit, delete or add records.

Records to edit must first be selected using the checkboxes to the right of each row, or the Select all and Invert selection links. Make whatever changes you like, and click the Save button at the bottom of the page to update the database. Or hit Cancel if you want to stop editing without saving your modifications. To delete records, select them using the same checkboxes and selection links, and click the Delete selected rows button. The chosen records will be immediately removed from the database with no further confirmation.

To add a new record, hit the Add row button below the table. An additional row will appear containing empty text boxes for you to enter new details. Clicking Save will add the new record to the table, and move the display so that you can see the new row. Alternately, you can click Cancel if you change your mind about adding a record. Normally, records are edited or added in text fields that appear in the table in the appropriate columns.

Instead, text boxes for fields are listed in a separate box inside or below the table, with field name labels to the right. For text or blob fields, a text box is displayed so that you can enter multiple lines of text if necessary.

When a table is removed from a database, all records and fields that it contains will be lost. You can remove any table, although deleting those in the mysql database is a bad idea as they contain important MySQL access control information. To remove one, the steps to follow are:. It is also possible to delete an entire database and all the tables and records in it. Any database can be removed, but deleting the mysql database is a very bad idea.

As usual, unless you have made a backup there is no way to undo the deletion. The steps to use it are:. The same page can be used to run multiple commands from a text file and display their output. Because the process is exactly the same as restoring a backup, it is explained in the restore part of the Backing up and restoring a database section below. If one of your databases contains important information, it should be backed up regularly in case a disk failure or SQL mistake causes data loss.

It is also a good idea to create a backup before performing some potentially risky operation, such as changing the type of a field or running a complex SQL statement that modifies lots of records.

Although this uses more disk space than a more compressed binary format would, it allows you to easy view and modify the file if you wish. It also means that a backup file can be used on a system with a different architecture, as the file contains only ASCII text. If you have a database that is being used for an important production purpose, it should be backed up regularly, such as once per day. Instead of following the instructions above every day, you can use the Scheduled Cron Jobs module covered in chapter 10 to create a job that does the backup for you.

To find out what command to run, use the instructions above to make a backup first and then visit the Webmin Actions Log module covered in chapter 54 to see command that it used. Once a backup file has been created, it can be restored on the same system or on another server running MySQL. Depending on what the Add drop table statements to backup? Therefore you should generally only restore if the tables do not exist, or contain outdated or invalid data that you want to overwrite.

Because a backup file is just a list of SQL statements, the restoration process just involves running all the commands in the file. This means that you can follow these same steps to execute a file of your own commands as well:.

Your MySQL database server requires all clients to authenticate themselves with a username and password before they can execute SQL commands.



0コメント

  • 1000 / 1000