Other platforms. Once your MySQL server is up and running, you can connect to it as the superuser root with the mysql client. On Linux, enter the following command at the command line terminal for installation using generic binaries, you might need to go first to the bin folder under the base directory of your MySQL installation :.
You are then asked for the root password, which was assigned in different manners according to the way you installed MySQL. The installation and initialization instructions given above already explain the root password, but here is a quick summary:. View it with, for example, the following command:. For installations using the MySQL APT repository or Debian packages directly downloaded from Oracle, you should have already assigned the root password yourself; if you have not done that for some reason, see the "Important" note here or How to Reset the Root Password.
For installations on Linux using the generic binaries followed by a data directory initialization using mysqld --initialize as discussed in Initializing the Data Directory , the generated root password is displayed in the standard error stream during the data directory's initialization:. Depending on the configuration you used to initialize the MySQL server, the error output might have been directed to the MySQL error log ; go there and check for the password if you do not see the above message on your screen.
The error log is a file with a. If you have initialized the data directory with mysqld --initialize-insecure instead, the root password is empty. If you have forgotten the root password you have chosen or have problems finding the temporary root password generated for you, see How to Reset the Root Password. At this point, if you have logged in using a temporary root password that was generated during the installation or initialization process which will be the case if you installed MySQL using the MySQL Yum repository, or using RPM packages or generic binaries from Oracle , change your root password by typing the following statement at the prompt:.
Until you change your root password, you will not be able to exercise any of the superuser privileges, even if you are logged in as root.
Here are a few useful things to remember when using the mysql client:. Column names are case-sensitive. Table names are case-sensitive on most Unix-like platforms, but not case-sensitive on Windows platforms. Case-sensitivity during string comparison depends on the character collation you use. In general, it is a good idea to treat all identifiers database names, table names, column names, etc. You can type your SQL statements on multiple lines by pressing Enter in the middle of it.
However, client commands for example, help , quit , and clear do not require a terminator. Here are some basic operations with the MySQL server. Showing existing databases. Creating a new database. Creating a table inside a database. First, pick the database in which you want to create the table with a USE statement:. Data types you can use in each column are explained in Data Types. Primary Key Optimization explains the concept of a primary key.
What follows a on each line is a comment, which is ignored by the mysql client; see Comments for other comment styles. If the MySQL root user account has a password, you need to invoke mysqladmin with the -p option and supply the password when prompted. This command invokes the MySQL administrative utility mysqladmin to connect to the server and tell it to shut down.
Users in the MySQL grant system are wholly independent from any operating system users under Windows. The service-installation command does not start the server. Instructions for that are given later in this section. On the Windows desktop, right-click the My Computer icon, and select Properties. Next select the Advanced tab from the System Properties menu that appears, and click the Environment Variables button.
Under System Variables , select Path , and then click the Edit button. The Edit System Variable dialogue should appear. Place your cursor at the end of the text appearing in the space marked Variable Value. Use the End key to ensure that your cursor is positioned at the very end of the text in this space.
Dismiss this dialogue, and each dialogue in turn, by clicking OK until all of the dialogues that were opened have been dismissed. You should now be able to invoke any MySQL executable program by typing its name at the DOS prompt from any directory on the system, without having to supply the path.
This includes the servers, the mysql client, and all MySQL command-line utilities such as mysqladmin and mysqldump. You must exercise great care when editing your system PATH by hand; accidental deletion or modification of any portion of the existing PATH value can leave you with a malfunctioning or even unusable system. You can specify a service name immediately following the --install option.
The default service name is MySQL. New in Version 1. New in Version 2. Making a Connection. Connect Using Server Explorer. Column Editor. Column Properties. Table Properties. Editing Indexes. Editing Foreign Keys. Editing Stored Procedures and Functions.
0コメント