Found 4220 Articles for MySQLi

Connect to MySQL database from command line

AmitDiwan
Updated on 09-Mar-2021 06:54:22

3K+ Views

Let us understand how MySQL can be connected to the database using the command-line. This is done for clients like mysql or mysqldump.The below command invokes mysql without specifying any explicit connection parameters −mysqlSince there are no parameter options, the default values will be applied −The default host name is localhost.The default user name is ODBC on Windows.No password is sent because neither --password nor -p has been mentioned.For mysql, the first non-option argument is considered the name of the default database. Since there is no such argument, mysql selects no default database.To specify the host name, user name and ... Read More

List down all the Tables in a MySQL Database

AmitDiwan
Updated on 09-Mar-2021 06:55:07

512 Views

Let us understand how to list down all the tables in a MySQL database −Once a database is created, we can access and use a specific database, using the following query −Querymysql> USE databaseName Database changedThe ‘USE’ statement doesn’t require a semi-colon. This is similar to the ‘QUIT’ statement. Even if semi-colon is used, it does no harm. We can create and use a database of our own, but before that, MySQL administrator’s permission is required.The MySQL administrator can execute a command as shown below to provide permissions −mysql> GRANT ALL ON tableName.* TO ‘your_mysql_name’@’your_client_host’;Here, ‘your_mysql_name’ refers to the MySQL ... Read More

Using MySQL with Apache

AmitDiwan
Updated on 08-Mar-2021 12:20:51

971 Views

Let us understand how to use MySQL wth Apache −Apache is a web server software which is developed and maintained by Apache software foundation. It is a software that takes requests from user to access a web page.A few security checks are performed on the HTTP request and then takes the user to the web page. There are many programs that allow authentication of the users from a MySQL database. These programs can also be used to write the log files into a MySQL table.The Apache logging format can be easily changed into readable mode by using MySQL, and putting ... Read More

Using MySQL in Batch Mode

AmitDiwan
Updated on 08-Mar-2021 12:18:55

1K+ Views

MySQL can be run in batch mode. To perform this, the statements that need to be executed should be put in a file and then ‘mysql’ should be indicated to read the input from this file. It can be done as shown below −shell> mysql < batch−fileIf mysql is running on Windows, and there are certain special characters on the file that could potentially create problems, the below line of code can be run −C:\> mysql −e "source batch−file"If the connection parameters need to be specified on the command line, the below line of code needs to be executed −shell> ... Read More

Getting Information About MySQL Databases and Tables

AmitDiwan
Updated on 09-Mar-2021 06:58:50

111 Views

It is possible for the user to forget the name of the database or table or the structure of table or the name of the columns. This issue can be solved using MySQL since it supports many statements that provide information about the databases and tables which it supports.The ‘SHOW DATABASES’ query can be used to list all the databases that are managed by the server. To see which database is currently in use, the ‘DATABASE()’ function.Let us understand this query in the below section −Querymysql> SELECT DATABASE();Output+---------------------+ | DATABASE()          | +---------------------+ | databaseInUse     ... Read More

Connecting to and Disconnecting from the MySQL Server

AmitDiwan
Updated on 08-Mar-2021 12:14:08

880 Views

A MySQL user name needs to be provided when ‘mysql’ is invoked. Next a password has to be entered. If the server runs on a system which is not the same as that on which the user logs in, the host name also needs to be provided while trying to log in.It is suggested to contact the administrator to find out the parameters that are required to connect to the server.Once the parameters are determined, the below lines need to be sued to connect to the server −shell> mysql −h host −u user −p Enter the password: ***Here, ‘host’ represents ... Read More

Entering MySQL Queries

AmitDiwan
Updated on 08-Mar-2021 12:13:36

340 Views

Before entering queries on the console, it is important to ensure that the user is connected to the server. The below query would give the version number of the server being used, and the current date.mysql> SELECT VERSION(), CURRENT_DATE;Note: The function ‘VERSION()’ and ‘CURRENT_DATE’ are case−insensitive. This means ‘version()’, ‘Version()’, ‘vERsion()’, all mean the same. Same goes with ‘CURRENT_DATE’An SQL query is followed by a semi-colon.When a query is issued to mysql, it sends the query to the server for execution. The results are computed and displayed. Another ‘mysql>’ also gets printed, indicating that the server is ready for one ... Read More

Upgrading MySQL with the MySQL SLES Repository

AmitDiwan
Updated on 08-Mar-2021 12:10:56

82 Views

MySQL can be upgraded using MySQL SLES repository. Let us see the steps required for this upgradation. By default, the MySQL SLES repository updates MySQL to the latest version in the release series that the user would have chosen during installationTo update to a different release series, the subrepository for the series that has been selected needs to be disabled. It is suggested to upgrade from one series to the next, instead of skipping a series. Inplace downgrading of MySQL is not supported while using MySQL SLES repository.Upgrade MySQLUpgrade MySQL and its components using the below command −shell> sudo zypper ... Read More

Upgrading MySQL with the MySQL APT Repository

AmitDiwan
Updated on 08-Mar-2021 12:10:31

105 Views

The MySQL APT repository can be used to perform an in-place upgrade for the MySQL installation.It can be done using the below steps −Upgrade MySQLEnsure that MySQL APT repository is already present on user’s system's repository list.Ensure that the most up−to−date package information on the MySQL APT repository is present by running the below command −shell> sudo apt-get updateBy default, the MySQL APT repository updates MySQL to the release series that has been selected by the user when they add the MySQL APT repository to their system.In general rule, it is suggested to upgrade from one release series to another, ... Read More

Upgrading MySQL with the MySQL Yum Repository

AmitDiwan
Updated on 08-Mar-2021 12:10:25

376 Views

Let us understand how to upgrade MySQL with the help of MySQL Yum repository −MySQL can be upgraded using MySQL Yum repository. Let us see the steps required for this upgradation. By default, the MySQL Yum repository updates MySQL to the latest version in the release series that the user would have chosen during installationTo update to a different release series, the subrepository for the series that has been selected needs to be disabled. The next step is to enable the subrepository for the target series. It is suggested to upgrade from one series to the next, instead of skipping ... Read More

Previous 1 ... 6 7 8 9 10 ... 422 Next
Advertisements