To create a new user within the MySQL shell use this sql syntax:

At this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell.

Therefore, the first thing to do is to provide the user with access to the information they will need.

The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.

Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges.

Your changes will now be in effect.

How To Grant Different User Permissions

Here is a short list of other common possible permissions that users can enjoy.

  • ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)
  • CREATE- allows them to create new tables or databases
  • DROP- allows them to them to delete tables or databases
  • DELETE- allows them to delete rows from tables
  • INSERT- allows them to insert rows into tables
  • SELECT- allows them to use the Select command to read through databases
  • UPDATE- allow them to update table rows
  • GRANT OPTION- allows them to grant or remove other users’ privileges

To provide a specific user with a permission, you can use this framework:

If you want to give them access to any database or to any table, make sure to put an asterisk (*) in the place of the database name or table name.

Each time you update or change a permission be sure to use the Flush Privileges command.

If you need to revoke a permission, the structure is almost identical to granting it:

Just as you can delete databases with DROP, you can use DROP to delete a user altogether:

To test out your new user, log out by typing

and log back in with this command in terminal:

php on windows

PHP remains the most widespread and popular server-side programming language on the web. It is installed by most web hosts, has a simple learning curve, close ties with the MySQL database, and an excellent collection of libraries to cut your development time. PHP may not be perfect, but it should certainly be considered for your next web application. Both Yahoo and Facebook use it with great success.

Why Install PHP Locally?

Installing PHP on your development PC allows you to safely create and test a web application without affecting the data or systems on your live website. This article describes PHP installation as a module within the Windows version of Apache 2.2. Mac and Linux users will probably have it installed already.

All-in-One packages

There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a single installation file, e.g. XAMPP (including a Mac version), WampServer and Web.Developer. There is nothing wrong with using these packages, although manually installing Apache and PHP will help you learn more about the system and its configuration options.

The PHP Installer

Although an installer is available from php.net, I would recommend the manual installation if you already have a web server configured and running.

Manual Installation

Manual installation offers several benefits:

  • backing up, reinstalling, or moving the web server can be achieved in seconds
  • you have more control over PHP and Apache configuration.

Step 1: download the files

Download the latest PHP 5 ZIP package from www.php.net/downloads.php

As always, virus scan the file and check its MD5 checksum using a tool such as fsum.

Step 2: extract the files

We will install the PHP files to C:php, so create that folder and extract the contents of the ZIP file into it.

PHP can be installed anywhere on your system, but you will need to change the paths referenced in the following steps.

Step 3: configure php.ini

Copy C:phpphp.ini-recommended to C:phpphp.ini. There are several lines you will need to change in a text editor (use search to find the current setting).

Define the extension directory:

Enable extensions. This will depend on the libraries you want to use, but the following extensions should be suitable for the majority of applications (remove the semi-colon comment):

If you want to send emails using the PHP mail() function, enter the details of an SMTP server (your ISP’s server should be suitable):

Step 4: add C:php to the path environment variable

To ensure Windows can find PHP, you need to change the path environment variable. From the Control Panel, choose System, (then “Advanced system settings” in Vista), select the “Advanced” tab, and click the “Environment Variables” button.

Scroll down the System variables list and click on “Path” followed by the “Edit” button. Enter “;C:php” to the end of the Variable value line (remember the semi-colon).

PHP path environment variable

Now OK your way out. You might need to reboot at this stage.

Step 5: configure PHP as an Apache module

Ensure Apache is not running (use “net stop Apache2.2” from the command line) and open its confhttpd.conf configuration file in an editor. The following lines should be changed:

Line 239, add index.php as a default file name:

At the bottom of the file, add the following lines (change the PHP file locations if necessary):

Save the configuration file and test it from the command line (Start > Run > cmd):

Step 6: test a PHP file

Create a file named index.php in Apache’s web page root (either htdocs or D:WebPages) and add this code:

Ensure Apache has started successfully, open a web browser and enter the address http://localhost/. If all goes well, a “PHP version” page should appear showing all the configuration settings.

Forgot you password to login into your wp-admin dashboard ? No problem !

As long as you can login into your Cpanel or into the server where you have WordPress running there is a way out !

You can do this using phpMyAdmin, MySql client or any MySql client.

You need to know the name of the user and have a password in mind.

After you login into your MySql database (phpMyAdmin or any other method from above) you need to update the table called wp_users referencing your user.

Example:

  • make sure you are logged into the right database(in case you have more wp databases)

  • this should fix it.

 

I hope this was helpful

 

 

Am găsit această eroare adăugând o nouă instanță de MySQL pe serverul meu de DEV.

Cannot open table mysql.innodb_index_stats

Eroare în log de eroare:

InnoDB: Error: Table “mysql”.”innodb_table_stats” not found

  • Nu am nici o idee ce poate cauza acest lucru, dar după ce am făcut niște cercetări am găsit că este bug și există o soluție.

Iată care sunt pașii le-am urmat și mia rezolvat problema:

1 – Trebuie să ștergeți aceste tabele din schema mysql:

2- Șterge toate fisierele .frm & .ibd ale tebelelor de mai sus din sistemul de operare.

3- Executați următorul script pentru a recrea tabelele.

4 – Reporniți instanța MySQL și fiți atenți la logul de erori.

Sper că acest post a fost util