Архив рубрики: bd

Fail to start MySQL

!!!After all for change password and privileges:

mysql_secure_installation

Symptoms

  • MySQL has been upgraded and now fails to start.
  • The following error message appears in /var/log/mysqld.log when trying to start MySQL:

    [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.

  • Plesk is not accessible with the following error message in a browser:

    ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory
    Additionally, an exception has occurred while trying to report this error: Zend_Exception
    No entry is registered for key 'translate' (Abstract.php:144)

Cause

MySQL 5.1 has been upgraded to 5.5 without running the «mysql_upgrade» command.

Resolution

  1. Connect to the Plesk server via SSH.
  2. Add the «skip-grant-tables» record to log in to MySQL:2.1. Open MySQL configuration file /etc/my.cnf in a text editor. In this example we use the vi editor:

    vi /etc/my.cnf

    2.2. Add «skip-grant-tables» on a new line under the [mysqld] section:

    [mysqld]
    skip-grant-tables
    <…>

    2.3. Save the changes and close the file.

  3. Start MySQL:

    service mysqld start

    OR

    service mysql start

  4. Complete the MySQL upgrade:

    mysql_upgrade

  5. Remove the line with «skip-grant-tables» from the /etc/my.cnf file.
  6. Restart MySQL:

    service mysqld restart

    OR

    service mysql start

 

For over ways https://ruhighload.com/mysql+1045+access+denied+for+user

 

Prevent Postgresql from running at startup

29

Note that with PostgreSQL 9.0 (and probably newer) on Mac OS 10.6.8 (and probably older), in order to prevent the PostgreSQL server from auto-starting, you have to:

  1. Go to /Library/LaunchDaemons/
  2. Open com.edb.launchd.postgresql-9.0.plist in an editor as root(replace 9.0 with your correct version number), e.g. sudo vim com.edb.launchd.postgresql-9.0.plist.
  3. Locate the line <key>RunAtLoad</key>
  4. Change the next line from <true/> to <false/>
  5. Save and exit.

That should do it. Also, if you want to stop the server immediately, without restarting, su to postgres and run /Library/PostgreSQL/9.0/bin/pg_ctl stop -D<your data dir>. You can find out which is your current data dir with ps aux|grep postgre.

Source: http://forums.enterprisedb.com/posts/list/2240.page#8321

Install mongodb on MacOS by steps

link   link2

For example install MondoDB 2.6.12 on macOS Catalina

  1. Download, extract and move:

    wget http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.6.12.tgz

    tar xzf mongodb-osx-x86_64-2.6.12.tgz

    mv mongodb-osx-x86_64-2.6.12/ /usr/local/mongodb/

  2. Add to file ~/.zshrc this:

    export PATH="$PATH:/usr/local/mongodb/bin"

    PS: .bash_profile or .profile not worked in my case

  3. Mkdir directory for data and set rights:

    mkdir -p ~/data/db

    chown -R mongodb.mongodb ~/data/db

  4. Run MongoDB:

    mongodb --dbpath ~/data/db

drop + add + refresh indexes

db.getSiblingDB('admin').runCommand({setParameter: 1, failIndexKeyTooLong: false})
use DB

db.getCollectionNames().forEach(function(collection) { 
 indexes = db[collection].getIndexes();
 print("Indexes for " + collection + ":");
 printjson(indexes);
});

db.COLLECTION.dropIndexes()

db.getCollectionNames().forEach(function(collection) { 
  print("Indexes for " + collection + ":"); 
  db[collection].dropIndexes(); 
});

db.getCollectionNames().forEach(function(collName) { db.runCommand({dropIndexes: collName, index: "*"}); });
rake db:mongoid:create_indexes RAILS_ENV=production
db.COLLECTION.getIndexes()
db.getCollectionNames().forEach(function(collection){db[collection].reIndex()})

mysql privilegies access

link

 

 

Your root account, and this statement applies to any account, may only have been added with localhost access (which is recommended).

You can check this with:

SELECT host FROM mysql.userWHEREUser='root';

If you only see results with localhost and 127.0.0.1, you cannot connect from an external source. If you see other IP addresses, but not the one you’re connecting from — that’s also an indication.

You will need to add the IP address of each system that you want to grant access to, and then grant privileges:

CREATEUSER'root'@'ip_address' IDENTIFIED BY'some_pass';GRANTALL PRIVILEGES ON*.*TO'root'@'ip_address';

If you see %, well then, there’s another problem altogether as that is «any remote source». If however you do want any/all systems to connect via root, use the % wildcard to grant access:

CREATEUSER'root'@'%' IDENTIFIED BY'some_pass';GRANTALL PRIVILEGES ON*.*TO'root'@'%';

Finally, reload the permissions, and you should be able to have remote access:

FLUSH PRIVILEGES;



Following two steps worked perfectly fine for me:

  1. Comment out the bind address from the file /etc/mysql/my.cnf:

    #bind-address = 127.0.0.1

  2. Run following query in phpMyAdmin:

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;





view install mysql in sustem and reinstall

rpm -qa | grep mysql
find / -name mysql-community-libs-5.7.9-1.e17.x86_64
yum install mysql mysql-devel mysql-libs mysql-server php-mysql linode-longview perl-DBD-MySQL php-cli php-fpm php-gd php-imap php-ldap php-magickwand php-mbstring php-mcrypt php-mssql php-odbc php-pdo php-pear php-process php-shout php-snmp php-soap  php-tidy php-xml php-xmlrpc php-common

PS may be problems without  compat-mysql51-5.1.73-1.el6.remi.x86_64

Indexes

About

Fix nessary indexes in code and recreate them:

rake db:mongoid:create_indexes RAILS_ENV=production

PS Before this I had to disable the errors when creating long indexes:

# mongo
MongoDB shell version:2.6.12
connecting to: test
> db.getSiblingDB('admin').runCommand({ setParameter:1, failIndexKeyTooLong:false})

Also may be needed reindex:

Also may be needed reindex:

db.getCollectionNames().forEach(function(collection){db[collection].reIndex()});

Main commands and configs

Commands:

service redis-server start
service mongodb start
service ssh --full-restart
source /usr/local/rvm/scripts/rvm

Packages:

  • AngularJS
  • BracketHighlighter
  • LESS
  • Package Control
  • SFTP
  • ColorPicker

Config:

{
 "bold_folder_labels": true,
 "caret_style": "phase",
 "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
 "enable_tab_scrolling": false,
 "fade_fold_buttons": false,
 "fallback_encoding": "Cyrillic (Windows 1251)",
 "font_size": 13,
 "highlight_line": true,
 "highlight_modified_tabs": true,
 "ignored_packages":
 [
 "RubyTest",
 "SublimeREPL",
 "Vintage"
 ],
 "line_padding_bottom": 1,
 "line_padding_top": 1,
 "show_encoding": true,
 "tab_size": 2,
 "translate_tabs_to_spaces": true,
 "update_check": false,
 "word_wrap": true
}